Mon Mar 19 11:30:36 2012

Asterisk developer's documentation


ast_expr2f.c File Reference

Dialplan Expression Lexical Scanner. More...

#include "asterisk.h"
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include <sys/types.h>
#include <locale.h>
#include <ctype.h>
#include <regex.h>
#include <limits.h>
#include "asterisk/ast_expr.h"
#include "asterisk/logger.h"
#include "asterisk/strings.h"
#include "asterisk/channel.h"
#include "ast_expr2.h"
#include <unistd.h>

Go to the source code of this file.

Data Structures

struct  parse_io
struct  val
struct  yy_buffer_state
struct  yy_trans_info
struct  yyguts_t

Defines

#define ast_yywrap(n)   1
#define BEGIN   yyg->yy_start = 1 + 2 *
#define ECHO   do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
#define EOB_ACT_CONTINUE_SCAN   0
#define EOB_ACT_END_OF_FILE   1
#define EOB_ACT_LAST_MATCH   2
#define FLEX_BETA
#define FLEX_SCANNER
#define FP___FMOD   fmod
#define FP___PRINTF   "%.16g"
#define FP___STRTOD   strtod
#define FP___TYPE   double
#define INITIAL   0
#define INT16_MAX   (32767)
#define INT16_MIN   (-32767-1)
#define INT32_MAX   (2147483647)
#define INT32_MIN   (-2147483647-1)
#define INT8_MAX   (127)
#define INT8_MIN   (-128)
#define REJECT   reject_used_but_not_detected
#define SET_COLUMNS
#define SET_NUMERIC_STRING
#define SET_STRING
#define trail   2
#define UINT16_MAX   (65535U)
#define UINT32_MAX   (4294967295U)
#define UINT8_MAX   (255U)
#define unput(c)   yyunput( c, yyg->yytext_ptr , yyscanner )
#define var   1
#define YY_AT_BOL()   (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
#define YY_BREAK   break;
#define YY_BUF_SIZE   16384
#define YY_BUFFER_EOF_PENDING   2
#define YY_BUFFER_NEW   0
#define YY_BUFFER_NORMAL   1
#define YY_CURRENT_BUFFER
#define YY_CURRENT_BUFFER_LVALUE   yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
#define YY_DECL
#define YY_DECL_IS_OURS   1
#define YY_DO_BEFORE_ACTION
#define YY_END_OF_BUFFER   39
#define YY_END_OF_BUFFER_CHAR   0
#define YY_EXIT_FAILURE   2
#define YY_EXTRA_TYPE   void *
#define YY_FATAL_ERROR(msg)   yy_fatal_error( msg , yyscanner)
#define yy_flex_debug   yyg->yy_flex_debug_r
#define YY_FLEX_MAJOR_VERSION   2
#define YY_FLEX_MINOR_VERSION   5
#define YY_FLEX_SUBMINOR_VERSION   35
#define YY_FLUSH_BUFFER   ast_yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
#define YY_INPUT(buf, result, max_size)
#define YY_INT_ALIGNED   short int
#define YY_LESS_LINENO(n)
#define YY_MORE_ADJ   yyg->yy_more_len
#define yy_new_buffer   ast_yy_create_buffer
#define YY_NEW_FILE   ast_yyrestart(yyin ,yyscanner )
#define YY_NULL   0
#define YY_NUM_RULES   38
#define YY_READ_BUF_SIZE   8192
#define YY_RESTORE_YY_MORE_OFFSET
#define YY_RULE_SETUP   YY_USER_ACTION
#define YY_SC_TO_UI(c)   ((unsigned int) (unsigned char) c)
#define yy_set_bol(at_bol)
#define yy_set_interactive(is_interactive)
#define YY_SKIP_YYWRAP
#define YY_START   ((yyg->yy_start - 1) / 2)
#define YY_START_STACK_INCR   25
#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
#define YY_STATE_EOF(state)   (YY_END_OF_BUFFER + state + 1)
#define yycolumn   (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
#define yyconst
#define yyextra   yyg->yyextra_r
#define yyin   yyg->yyin_r
#define yyleng   yyg->yyleng_r
#define yyless(n)
#define yyless(n)
#define yylineno   (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
#define yylloc   yyg->yylloc_r
#define yylval   yyg->yylval_r
#define yymore()   (yyg->yy_more_flag = 1)
#define yyout   yyg->yyout_r
#define YYSTATE   YY_START
#define YYTABLES_NAME   "yytables"
#define yyterminate()   return YY_NULL
#define yytext   yyg->yytext_r
#define yytext_ptr   yytext_r

Typedefs

typedef short int flex_int16_t
typedef int flex_int32_t
typedef signed char flex_int8_t
typedef unsigned short int flex_uint16_t
typedef unsigned int flex_uint32_t
typedef unsigned char flex_uint8_t
typedef yy_buffer_stateYY_BUFFER_STATE
typedef unsigned char YY_CHAR
typedef size_t yy_size_t
typedef int yy_state_type
typedef void * yyscan_t

Enumerations

enum  valtype { AST_EXPR_number, AST_EXPR_numeric_string, AST_EXPR_string }

Functions

int ast_expr (char *expr, char *buf, int length, struct ast_channel *chan)
 Evaluate the given expression.
void ast_expr_clear_extra_error_info (void)
void ast_expr_register_extra_error_info (char *message)
int ast_str_expr (struct ast_str **str, ssize_t maxlen, struct ast_channel *chan, char *expr)
 Evaluate the given expression.
YY_BUFFER_STATE ast_yy_create_buffer (FILE *file, int size, yyscan_t yyscanner)
void ast_yy_delete_buffer (YY_BUFFER_STATE b, yyscan_t yyscanner)
void ast_yy_flush_buffer (YY_BUFFER_STATE b, yyscan_t yyscanner)
static void ast_yy_init_buffer (YY_BUFFER_STATE b, FILE *file, yyscan_t yyscanner)
static void ast_yy_load_buffer_state (yyscan_t yyscanner)
YY_BUFFER_STATE ast_yy_scan_buffer (char *base, yy_size_t size, yyscan_t yyscanner)
YY_BUFFER_STATE ast_yy_scan_bytes (yyconst char *bytes, int len, yyscan_t yyscanner)
YY_BUFFER_STATE ast_yy_scan_string (yyconst char *yy_str, yyscan_t yyscanner)
void ast_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer, yyscan_t yyscanner)
void * ast_yyalloc (yy_size_t, yyscan_t yyscanner)
static void ast_yyensure_buffer_stack (yyscan_t yyscanner)
int ast_yyerror (const char *s, yyltype *loc, struct parse_io *parseio)
int ast_yyerror (const char *, YYLTYPE *, struct parse_io *)
void ast_yyfree (void *, yyscan_t yyscanner)
int ast_yyget_column (yyscan_t yyscanner)
int ast_yyget_debug (yyscan_t yyscanner)
YY_EXTRA_TYPE ast_yyget_extra (yyscan_t yyscanner)
FILE * ast_yyget_in (yyscan_t yyscanner)
int ast_yyget_leng (yyscan_t yyscanner)
int ast_yyget_lineno (yyscan_t yyscanner)
YYLTYPEast_yyget_lloc (yyscan_t yyscanner)
YYSTYPEast_yyget_lval (yyscan_t yyscanner)
FILE * ast_yyget_out (yyscan_t yyscanner)
char * ast_yyget_text (yyscan_t yyscanner)
int ast_yylex (YYSTYPE *yylval_param, YYLTYPE *yylloc_param, yyscan_t yyscanner)
int ast_yylex_destroy (yyscan_t yyscanner)
int ast_yylex_init (yyscan_t *scanner)
int ast_yylex_init_extra (YY_EXTRA_TYPE user_defined, yyscan_t *scanner)
int ast_yyparse (void *)
void ast_yypop_buffer_state (yyscan_t yyscanner)
void ast_yypush_buffer_state (YY_BUFFER_STATE new_buffer, yyscan_t yyscanner)
void * ast_yyrealloc (void *, yy_size_t, yyscan_t yyscanner)
void ast_yyrestart (FILE *input_file, yyscan_t yyscanner)
void ast_yyset_column (int column_no, yyscan_t yyscanner)
void ast_yyset_debug (int debug_flag, yyscan_t yyscanner)
void ast_yyset_extra (YY_EXTRA_TYPE user_defined, yyscan_t yyscanner)
void ast_yyset_in (FILE *in_str, yyscan_t yyscanner)
void ast_yyset_lineno (int line_number, yyscan_t yyscanner)
void ast_yyset_lloc (YYLTYPE *yylloc_param, yyscan_t yyscanner)
void ast_yyset_lval (YYSTYPE *yylval_param, yyscan_t yyscanner)
void ast_yyset_out (FILE *out_str, yyscan_t yyscanner)
static char * expr2_token_subst (const char *mess)
static int input (yyscan_t yyscanner)
static void yy_fatal_error (yyconst char *msg, yyscan_t yyscanner)
static void yy_fatal_error (yyconst char msg[], yyscan_t yyscanner)
static int yy_get_next_buffer (yyscan_t yyscanner)
static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
static int yy_init_globals (yyscan_t yyscanner)
static yy_state_type yy_try_NUL_trans (yy_state_type current_state, yyscan_t yyscanner)
static void yyunput (int c, char *buf_ptr, yyscan_t yyscanner)

Variables

static int curlycount = 0
static const char *const expr2_token_equivs1 []
static const char *const expr2_token_equivs2 []
char extra_error_message [4095]
int extra_error_message_supplied = 0
static yyconst flex_int16_t yy_accept [63]
static yyconst flex_int16_t yy_base [70]
static yyconst flex_int16_t yy_chk [159]
static yyconst flex_int16_t yy_def [70]
static yyconst flex_int32_t yy_ec [256]
static yyconst flex_int32_t yy_meta [29]
static yyconst flex_int16_t yy_nxt [159]


Detailed Description

Dialplan Expression Lexical Scanner.

Definition in file ast_expr2f.c.


Define Documentation

#define ast_yywrap (  )     1

Definition at line 339 of file ast_expr2f.c.

#define BEGIN   yyg->yy_start = 1 + 2 *

Definition at line 145 of file ast_expr2f.c.

#define ECHO   do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)

Definition at line 564 of file ast_expr2f.c.

Referenced by ast_hide_password(), ast_restore_tty(), and openserial().

#define EOB_ACT_CONTINUE_SCAN   0

Definition at line 184 of file ast_expr2f.c.

#define EOB_ACT_END_OF_FILE   1

Definition at line 185 of file ast_expr2f.c.

#define EOB_ACT_LAST_MATCH   2

Definition at line 186 of file ast_expr2f.c.

#define FLEX_BETA

Definition at line 16 of file ast_expr2f.c.

#define FLEX_SCANNER

Definition at line 11 of file ast_expr2f.c.

#define FP___FMOD   fmod

Definition at line 537 of file ast_expr2f.c.

#define FP___PRINTF   "%.16g"

Definition at line 536 of file ast_expr2f.c.

#define FP___STRTOD   strtod

Definition at line 538 of file ast_expr2f.c.

#define FP___TYPE   double

Definition at line 539 of file ast_expr2f.c.

#define INITIAL   0

Definition at line 614 of file ast_expr2f.c.

#define INT16_MAX   (32767)

Definition at line 74 of file ast_expr2f.c.

Referenced by fsaturate().

#define INT16_MIN   (-32767-1)

Definition at line 65 of file ast_expr2f.c.

Referenced by fsaturate().

#define INT32_MAX   (2147483647)

Definition at line 77 of file ast_expr2f.c.

#define INT32_MIN   (-2147483647-1)

Definition at line 68 of file ast_expr2f.c.

#define INT8_MAX   (127)

Definition at line 71 of file ast_expr2f.c.

#define INT8_MIN   (-128)

Definition at line 62 of file ast_expr2f.c.

#define REJECT   reject_used_but_not_detected

Definition at line 490 of file ast_expr2f.c.

#define SET_COLUMNS

Value:

do {     \
   yylloc_param->first_column = (int)(yyg->yytext_r - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf); \
   yylloc_param->last_column += yyleng - 1; \
   yylloc_param->first_line = yylloc_param->last_line = 1; \
   } while (0)

Definition at line 581 of file ast_expr2f.c.

#define SET_NUMERIC_STRING

Value:

do {  \
   yylval_param->val = calloc(1, sizeof(struct val)); \
   yylval_param->val->type = AST_EXPR_numeric_string; \
   yylval_param->val->u.s = strdup(yytext);  \
   } while (0)

Definition at line 593 of file ast_expr2f.c.

#define SET_STRING

Value:

do {     \
   yylval_param->val = calloc(1, sizeof(struct val)); \
   yylval_param->val->type = AST_EXPR_string;      \
   yylval_param->val->u.s = strdup(yytext);     \
   } while (0)

Definition at line 587 of file ast_expr2f.c.

#define trail   2

Definition at line 616 of file ast_expr2f.c.

#define UINT16_MAX   (65535U)

Definition at line 83 of file ast_expr2f.c.

#define UINT32_MAX   (4294967295U)

Definition at line 86 of file ast_expr2f.c.

#define UINT8_MAX   (255U)

Definition at line 80 of file ast_expr2f.c.

#define unput (  )     yyunput( c, yyg->yytext_ptr , yyscanner )

Definition at line 204 of file ast_expr2f.c.

#define var   1

Definition at line 615 of file ast_expr2f.c.

Referenced by __init_manager(), acf_iaxvar_read(), acf_iaxvar_write(), acf_sprintf(), actual_load_config(), add_cfg_entry(), add_rt_cfg_entry(), add_rt_multi_cfg_entry(), add_user_extension(), aji_create_client(), aji_load_config(), append_channel_vars(), append_mailbox_mapping(), apply_general_options(), apply_options(), apply_options_full(), apply_outgoing(), ast_bridge_timelimit(), ast_cdr_copy_vars(), ast_cdr_data_add_structure(), ast_cdr_serialize_variables(), ast_channeltype_list(), ast_config_text_file_save(), ast_http_get_post_vars(), ast_iax2_new(), ast_plc_reload(), ast_var_assign(), ast_var_delete(), ast_var_full_name(), ast_var_name(), ast_var_value(), ast_variables_dup(), authenticate_reply(), build_event_channel(), build_extension(), build_parkinglot(), build_profile(), clearvar_prefix(), cli_realtime_load(), conf_exec(), conf_run(), config_module(), console_cmd(), copy_plain_file(), create_vmaccount(), crement_function_read(), delete_extension(), find_conf(), find_conf_realtime(), find_realtime(), find_user_realtime(), free_channelvars(), function_realtime_read(), function_realtime_readdestroy(), get_insecure_variable_from_config(), get_insecure_variable_from_sippeers(), get_insecure_variable_from_sipregs(), get_name_from_variable(), global_read(), gtalk_create_member(), gtalk_load_config(), handle_updates(), handle_uri(), http_post_callback(), iax2_call(), iax_parse_ies(), inherit_category(), init_logger_chain(), jingle_create_member(), jingle_load_config(), ldap_loadentry(), ldap_table_config_add_attribute(), leave_queue(), load_channelvars(), load_config(), load_moh_classes(), local_ast_moh_start(), man_do_variable_value(), manager_sipnotify(), message_template_build(), minivm_account_func_read(), move_variables(), odbc_load_module(), osp_create_provider(), parkinglot_config_read(), parkinglot_feature_flag_cfg(), parse_config(), parse_cookies(), pbx_builtin_serialize_variables(), pbx_substitute_variables_helper_full(), phoneprov_callback(), prep_email_sub_vars(), process_applicationmap_line(), process_config(), process_text_line(), profile_destructor(), queue_function_queuewaitingcount(), realtime_alias(), realtime_canmatch(), realtime_common(), realtime_curl(), realtime_directory(), realtime_exec(), realtime_exists(), realtime_ldap(), realtime_ldap_entry_to_var(), realtime_ldap_result_to_vars(), realtime_matchmore(), realtime_multi_curl(), realtime_multi_ldap(), realtime_multi_odbc(), realtime_multi_pgsql(), realtime_odbc(), realtime_peer(), realtime_peer_by_addr(), realtime_peer_by_name(), realtime_peer_get_sippeer_helper(), realtime_pgsql(), realtime_switch_common(), realtime_user(), realtimefield_read(), reload(), reload_followme(), reload_module(), reload_single_queue(), retrieve_astcfgint(), rt_extend_conf(), semicolon_count_var(), set_config(), set_timezone_variables(), shared_read(), shared_variable_free(), shared_write(), shift_pop(), show_users_realtime(), sip_cli_notify(), sla_add_trunk_to_station(), sla_build_station(), sla_build_trunk(), socket_process(), transmit_invite(), unload_module(), unshift_push(), variable_named(), vm_change_password(), write_password_to_file(), and xml_translate().

 
#define YY_AT_BOL (  )     (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)

Definition at line 335 of file ast_expr2f.c.

#define YY_BREAK   break;

Definition at line 845 of file ast_expr2f.c.

#define YY_BUF_SIZE   16384

Definition at line 171 of file ast_expr2f.c.

#define YY_BUFFER_EOF_PENDING   2

Definition at line 271 of file ast_expr2f.c.

#define YY_BUFFER_NEW   0

Definition at line 259 of file ast_expr2f.c.

Referenced by ast_yy_flush_buffer(), and ast_yy_scan_buffer().

#define YY_BUFFER_NORMAL   1

Definition at line 260 of file ast_expr2f.c.

#define YY_CURRENT_BUFFER

Value:

( yyg->yy_buffer_stack \
                          ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
                          : NULL)

Definition at line 282 of file ast_expr2f.c.

Referenced by ast_yy_flush_buffer(), ast_yy_init_buffer(), ast_yyget_column(), ast_yyget_lineno(), ast_yylex_destroy(), ast_yypop_buffer_state(), ast_yypush_buffer_state(), ast_yyset_column(), and ast_yyset_lineno().

#define YY_CURRENT_BUFFER_LVALUE   yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]

Definition at line 289 of file ast_expr2f.c.

Referenced by ast_yyerror(), ast_yylex_destroy(), ast_yypop_buffer_state(), and ast_yypush_buffer_state().

#define YY_DECL

Value:

int ast_yylex \
               (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner)

Definition at line 832 of file ast_expr2f.c.

#define YY_DECL_IS_OURS   1

Definition at line 827 of file ast_expr2f.c.

#define YY_DO_BEFORE_ACTION

Definition at line 356 of file ast_expr2f.c.

#define YY_END_OF_BUFFER   39

Definition at line 365 of file ast_expr2f.c.

#define YY_END_OF_BUFFER_CHAR   0

Definition at line 160 of file ast_expr2f.c.

Referenced by ast_yy_flush_buffer(), ast_yy_scan_buffer(), and ast_yy_scan_bytes().

#define YY_EXIT_FAILURE   2

Definition at line 2019 of file ast_expr2f.c.

Referenced by yy_fatal_error().

#define YY_EXTRA_TYPE   void *

Definition at line 627 of file ast_expr2f.c.

#define YY_FATAL_ERROR ( msg   )     yy_fatal_error( msg , yyscanner)

Definition at line 818 of file ast_expr2f.c.

Referenced by ast_yy_scan_buffer(), ast_yy_scan_bytes(), and ast_yyensure_buffer_stack().

#define yy_flex_debug   yyg->yy_flex_debug_r

Definition at line 139 of file ast_expr2f.c.

Referenced by ast_yyget_debug(), and ast_yyset_debug().

#define YY_FLEX_MAJOR_VERSION   2

Definition at line 12 of file ast_expr2f.c.

#define YY_FLEX_MINOR_VERSION   5

Definition at line 13 of file ast_expr2f.c.

#define YY_FLEX_SUBMINOR_VERSION   35

Definition at line 14 of file ast_expr2f.c.

#define YY_FLUSH_BUFFER   ast_yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner)

Definition at line 303 of file ast_expr2f.c.

#define YY_INPUT ( buf,
result,
max_size   ) 

Definition at line 771 of file ast_expr2f.c.

#define YY_INT_ALIGNED   short int

Definition at line 7 of file ast_expr2f.c.

#define YY_LESS_LINENO (  ) 

Definition at line 188 of file ast_expr2f.c.

#define YY_MORE_ADJ   yyg->yy_more_len

Definition at line 492 of file ast_expr2f.c.

#define yy_new_buffer   ast_yy_create_buffer

Definition at line 313 of file ast_expr2f.c.

#define YY_NEW_FILE   ast_yyrestart(yyin ,yyscanner )

Definition at line 158 of file ast_expr2f.c.

#define YY_NULL   0

Definition at line 115 of file ast_expr2f.c.

#define YY_NUM_RULES   38

Definition at line 364 of file ast_expr2f.c.

#define YY_READ_BUF_SIZE   8192

Definition at line 755 of file ast_expr2f.c.

#define YY_RESTORE_YY_MORE_OFFSET

Definition at line 493 of file ast_expr2f.c.

#define YY_RULE_SETUP   YY_USER_ACTION

Definition at line 848 of file ast_expr2f.c.

#define YY_SC_TO_UI (  )     ((unsigned int) (unsigned char) c)

Definition at line 122 of file ast_expr2f.c.

#define yy_set_bol ( at_bol   ) 

Definition at line 325 of file ast_expr2f.c.

#define yy_set_interactive ( is_interactive   ) 

Definition at line 315 of file ast_expr2f.c.

#define YY_SKIP_YYWRAP

Definition at line 340 of file ast_expr2f.c.

#define YY_START   ((yyg->yy_start - 1) / 2)

Definition at line 151 of file ast_expr2f.c.

#define YY_START_STACK_INCR   25

Definition at line 813 of file ast_expr2f.c.

#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))

Definition at line 177 of file ast_expr2f.c.

#define YY_STATE_EOF ( state   )     (YY_END_OF_BUFFER + state + 1)

Definition at line 155 of file ast_expr2f.c.

#define yycolumn   (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)

Definition at line 138 of file ast_expr2f.c.

Referenced by ast_yyget_column(), and ast_yyset_column().

#define yyconst

Definition at line 111 of file ast_expr2f.c.

#define yyextra   yyg->yyextra_r

Definition at line 134 of file ast_expr2f.c.

Referenced by ast_yyget_extra(), and ast_yyset_extra().

#define yyin   yyg->yyin_r

Definition at line 132 of file ast_expr2f.c.

Referenced by ast_yyget_in(), ast_yyset_in(), and yy_init_globals().

#define yyleng   yyg->yyleng_r

Definition at line 135 of file ast_expr2f.c.

Referenced by ast_yyget_leng().

#define yyless (  ) 

Definition at line 2031 of file ast_expr2f.c.

#define yyless (  ) 

Definition at line 2031 of file ast_expr2f.c.

#define yylineno   (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)

Definition at line 137 of file ast_expr2f.c.

Referenced by ast_yyget_lineno(), and ast_yyset_lineno().

#define yylloc   yyg->yylloc_r

Definition at line 674 of file ast_expr2f.c.

#define yylval   yyg->yylval_r

Definition at line 672 of file ast_expr2f.c.

 
#define yymore (  )     (yyg->yy_more_flag = 1)

Definition at line 491 of file ast_expr2f.c.

#define yyout   yyg->yyout_r

Definition at line 133 of file ast_expr2f.c.

Referenced by ast_yyget_out(), ast_yyset_out(), and yy_init_globals().

#define YYSTATE   YY_START

Definition at line 152 of file ast_expr2f.c.

#define YYTABLES_NAME   "yytables"

Definition at line 2383 of file ast_expr2f.c.

 
#define yyterminate (  )     return YY_NULL

Definition at line 808 of file ast_expr2f.c.

#define yytext   yyg->yytext_r

Definition at line 136 of file ast_expr2f.c.

Referenced by ast_yyerror(), and ast_yyget_text().

#define yytext_ptr   yytext_r

Definition at line 346 of file ast_expr2f.c.


Typedef Documentation

typedef short int flex_int16_t

Definition at line 54 of file ast_expr2f.c.

typedef int flex_int32_t

Definition at line 55 of file ast_expr2f.c.

typedef signed char flex_int8_t

Definition at line 53 of file ast_expr2f.c.

typedef unsigned short int flex_uint16_t

Definition at line 57 of file ast_expr2f.c.

typedef unsigned int flex_uint32_t

Definition at line 58 of file ast_expr2f.c.

typedef unsigned char flex_uint8_t

Definition at line 56 of file ast_expr2f.c.

typedef struct yy_buffer_state* YY_BUFFER_STATE

Definition at line 181 of file ast_expr2f.c.

typedef unsigned char YY_CHAR

Definition at line 342 of file ast_expr2f.c.

typedef size_t yy_size_t

Definition at line 208 of file ast_expr2f.c.

typedef int yy_state_type

Definition at line 344 of file ast_expr2f.c.

typedef void* yyscan_t

Definition at line 127 of file ast_expr2f.c.


Enumeration Type Documentation

enum valtype

Enumerator:
AST_EXPR_number 
AST_EXPR_numeric_string 
AST_EXPR_string 

Definition at line 567 of file ast_expr2f.c.


Function Documentation

int ast_expr ( char *  expr,
char *  buf,
int  length,
struct ast_channel chan 
)

Evaluate the given expression.

Parameters:
expr An expression
buf Result buffer
length Size of the result buffer, in bytes
chan Channel to use for evaluating included dialplan functions, if any
Returns:
Length of the result string, in bytes

Definition at line 2406 of file ast_expr2f.c.

References ast_copy_string(), AST_EXPR_number, ast_yy_scan_string(), ast_yylex_destroy(), ast_yylex_init(), ast_yyparse(), parse_io::chan, FP___PRINTF, free, and io.

02407 {
02408    struct parse_io io = { .string = expr, .chan = chan };
02409    int return_value = 0;
02410 
02411    ast_yylex_init(&io.scanner);
02412 
02413    ast_yy_scan_string(expr, io.scanner);
02414 
02415    ast_yyparse ((void *) &io);
02416 
02417    ast_yylex_destroy(io.scanner);
02418 
02419    if (!io.val) {
02420       if (length > 1) {
02421          strcpy(buf, "0");
02422          return_value = 1;
02423       }
02424    } else {
02425       if (io.val->type == AST_EXPR_number) {
02426          int res_length;
02427 
02428          res_length = snprintf(buf, length, FP___PRINTF, io.val->u.i);
02429          return_value = (res_length <= length) ? res_length : length;
02430       } else {
02431          if (io.val->u.s)
02432 #if defined(STANDALONE) || defined(LOW_MEMORY) || defined(STANDALONE)
02433             strncpy(buf, io.val->u.s, length - 1);
02434 #else /* !STANDALONE && !LOW_MEMORY */
02435             ast_copy_string(buf, io.val->u.s, length);
02436 #endif /* STANDALONE || LOW_MEMORY */
02437          else
02438             buf[0] = 0;
02439          return_value = strlen(buf);
02440          free(io.val->u.s);
02441       }
02442       free(io.val);
02443    }
02444    return return_value;
02445 }

void ast_expr_clear_extra_error_info ( void   ) 

void ast_expr_register_extra_error_info ( char *  message  ) 

int ast_str_expr ( struct ast_str **  str,
ssize_t  maxlen,
struct ast_channel chan,
char *  expr 
)

Evaluate the given expression.

Parameters:
str Dynamic result buffer
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
chan Channel to use for evaluating included dialplan functions, if any
expr An expression
Returns:
Length of the result string, in bytes

Definition at line 2448 of file ast_expr2f.c.

References AST_EXPR_number, ast_str_set(), ast_str_strlen(), ast_yy_scan_string(), ast_yylex_destroy(), ast_yylex_init(), ast_yyparse(), parse_io::chan, FP___PRINTF, free, io, and str.

Referenced by ast_str_substitute_variables_full().

02449 {
02450    struct parse_io io = { .string = expr, .chan = chan };
02451 
02452    ast_yylex_init(&io.scanner);
02453    ast_yy_scan_string(expr, io.scanner);
02454    ast_yyparse ((void *) &io);
02455    ast_yylex_destroy(io.scanner);
02456 
02457    if (!io.val) {
02458       ast_str_set(str, maxlen, "0");
02459    } else {
02460       if (io.val->type == AST_EXPR_number) {
02461          int res_length;
02462          ast_str_set(str, maxlen, FP___PRINTF, io.val->u.i);
02463       } else if (io.val->u.s) {
02464          ast_str_set(str, maxlen, "%s", io.val->u.s);
02465          free(io.val->u.s);
02466       }
02467       free(io.val);
02468    }
02469    return ast_str_strlen(*str);
02470 }

YY_BUFFER_STATE ast_yy_create_buffer ( FILE *  file,
int  size,
yyscan_t  yyscanner 
)

void ast_yy_delete_buffer ( YY_BUFFER_STATE  b,
yyscan_t  yyscanner 
)

Referenced by ast_yylex_destroy(), and ast_yypop_buffer_state().

void ast_yy_flush_buffer ( YY_BUFFER_STATE  b,
yyscan_t  yyscanner 
)

Discard all buffered characters. On the next scan, YY_INPUT will be called.

Parameters:
b the buffer state to be flushed, usually YY_CURRENT_BUFFER.
yyscanner The scanner object.

Definition at line 1807 of file ast_expr2f.c.

References ast_yy_load_buffer_state(), yy_buffer_state::yy_at_bol, yy_buffer_state::yy_buf_pos, YY_BUFFER_NEW, yy_buffer_state::yy_buffer_status, yy_buffer_state::yy_ch_buf, YY_CURRENT_BUFFER, YY_END_OF_BUFFER_CHAR, and yy_buffer_state::yy_n_chars.

Referenced by ast_yy_init_buffer().

01808 {
01809     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01810    if ( ! b )
01811       return;
01812 
01813    b->yy_n_chars = 0;
01814 
01815    /* We always need two end-of-buffer characters.  The first causes
01816     * a transition to the end-of-buffer state.  The second causes
01817     * a jam in that state.
01818     */
01819    b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
01820    b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
01821 
01822    b->yy_buf_pos = &b->yy_ch_buf[0];
01823 
01824    b->yy_at_bol = 1;
01825    b->yy_buffer_status = YY_BUFFER_NEW;
01826 
01827    if ( b == YY_CURRENT_BUFFER )
01828       ast_yy_load_buffer_state(yyscanner );
01829 }

static void ast_yy_init_buffer ( YY_BUFFER_STATE  b,
FILE *  file,
yyscan_t  yyscanner 
) [static]

The main scanner function which does all the work.

Definition at line 1778 of file ast_expr2f.c.

References ast_yy_flush_buffer(), errno, and YY_CURRENT_BUFFER.

01780 {
01781    int oerrno = errno;
01782     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01783 
01784    ast_yy_flush_buffer(b ,yyscanner);
01785 
01786    b->yy_input_file = file;
01787    b->yy_fill_buffer = 1;
01788 
01789     /* If b is the current buffer, then ast_yy_init_buffer was _probably_
01790      * called from ast_yyrestart() or through yy_get_next_buffer.
01791      * In that case, we don't want to reset the lineno or column.
01792      */
01793     if (b != YY_CURRENT_BUFFER){
01794         b->yy_bs_lineno = 1;
01795         b->yy_bs_column = 0;
01796     }
01797 
01798         b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
01799     
01800    errno = oerrno;
01801 }

static void ast_yy_load_buffer_state ( yyscan_t  yyscanner  )  [static]

Referenced by ast_yy_flush_buffer(), ast_yypop_buffer_state(), and ast_yypush_buffer_state().

YY_BUFFER_STATE ast_yy_scan_buffer ( char *  base,
yy_size_t  size,
yyscan_t  yyscanner 
)

Setup the input buffer state to scan directly from a user-specified character buffer.

Parameters:
base the character buffer
size the size in bytes of the character buffer
yyscanner The scanner object.
Returns:
the newly allocated buffer state object.

Definition at line 1938 of file ast_expr2f.c.

References ast_yy_switch_to_buffer(), ast_yyalloc(), yy_buffer_state::yy_at_bol, yy_buffer_state::yy_buf_pos, yy_buffer_state::yy_buf_size, YY_BUFFER_NEW, yy_buffer_state::yy_buffer_status, yy_buffer_state::yy_ch_buf, YY_END_OF_BUFFER_CHAR, YY_FATAL_ERROR, yy_buffer_state::yy_fill_buffer, yy_buffer_state::yy_input_file, yy_buffer_state::yy_is_interactive, yy_buffer_state::yy_is_our_buffer, and yy_buffer_state::yy_n_chars.

Referenced by ast_yy_scan_bytes().

01939 {
01940    YY_BUFFER_STATE b;
01941     
01942    if ( size < 2 ||
01943         base[size-2] != YY_END_OF_BUFFER_CHAR ||
01944         base[size-1] != YY_END_OF_BUFFER_CHAR )
01945       /* They forgot to leave room for the EOB's. */
01946       return 0;
01947 
01948    b = (YY_BUFFER_STATE) ast_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
01949    if ( ! b )
01950       YY_FATAL_ERROR( "out of dynamic memory in ast_yy_scan_buffer()" );
01951 
01952    b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
01953    b->yy_buf_pos = b->yy_ch_buf = base;
01954    b->yy_is_our_buffer = 0;
01955    b->yy_input_file = 0;
01956    b->yy_n_chars = b->yy_buf_size;
01957    b->yy_is_interactive = 0;
01958    b->yy_at_bol = 1;
01959    b->yy_fill_buffer = 0;
01960    b->yy_buffer_status = YY_BUFFER_NEW;
01961 
01962    ast_yy_switch_to_buffer(b ,yyscanner );
01963 
01964    return b;
01965 }

YY_BUFFER_STATE ast_yy_scan_bytes ( yyconst char *  yybytes,
int  _yybytes_len,
yyscan_t  yyscanner 
)

Setup the input buffer state to scan the given bytes. The next call to ast_yylex() will scan from a copy of bytes.

Parameters:
yybytes the byte buffer to scan
_yybytes_len the number of bytes in the buffer pointed to by bytes.
yyscanner The scanner object.
Returns:
the newly allocated buffer state object.

Definition at line 1988 of file ast_expr2f.c.

References ast_yy_scan_buffer(), ast_yyalloc(), YY_END_OF_BUFFER_CHAR, YY_FATAL_ERROR, and yy_buffer_state::yy_is_our_buffer.

Referenced by ast_yy_scan_string().

01989 {
01990    YY_BUFFER_STATE b;
01991    char *buf;
01992    yy_size_t n;
01993    int i;
01994     
01995    /* Get memory for full buffer, including space for trailing EOB's. */
01996    n = _yybytes_len + 2;
01997    buf = (char *) ast_yyalloc(n ,yyscanner );
01998    if ( ! buf )
01999       YY_FATAL_ERROR( "out of dynamic memory in ast_yy_scan_bytes()" );
02000 
02001    for ( i = 0; i < _yybytes_len; ++i )
02002       buf[i] = yybytes[i];
02003 
02004    buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
02005 
02006    b = ast_yy_scan_buffer(buf,n ,yyscanner);
02007    if ( ! b )
02008       YY_FATAL_ERROR( "bad buffer in ast_yy_scan_bytes()" );
02009 
02010    /* It's okay to grow etc. this buffer, and we should throw it
02011     * away when we're done.
02012     */
02013    b->yy_is_our_buffer = 1;
02014 
02015    return b;
02016 }

YY_BUFFER_STATE ast_yy_scan_string ( yyconst char *  yystr,
yyscan_t  yyscanner 
)

Setup the input buffer state to scan a string. The next call to ast_yylex() will scan from a copy of str.

Parameters:
yystr a NUL-terminated string to scan
yyscanner The scanner object.
Returns:
the newly allocated buffer state object.
Note:
If you want to scan bytes that may contain NUL values, then use ast_yy_scan_bytes() instead.

Definition at line 1975 of file ast_expr2f.c.

References ast_yy_scan_bytes().

Referenced by ast_expr(), and ast_str_expr().

01976 {
01977     
01978    return ast_yy_scan_bytes(yystr,strlen(yystr) ,yyscanner);
01979 }

void ast_yy_switch_to_buffer ( YY_BUFFER_STATE  new_buffer,
yyscan_t  yyscanner 
)

Referenced by ast_yy_scan_buffer().

void * ast_yyalloc ( yy_size_t  ,
yyscan_t  yyscanner 
)

Definition at line 2366 of file ast_expr2f.c.

References malloc.

Referenced by ast_yy_scan_buffer(), ast_yy_scan_bytes(), ast_yyensure_buffer_stack(), ast_yylex_init(), and ast_yylex_init_extra().

02367 {
02368    return (void *) malloc( size );
02369 }

static void ast_yyensure_buffer_stack ( yyscan_t  yyscanner  )  [static]

Definition at line 1888 of file ast_expr2f.c.

References ast_yyalloc(), ast_yyrealloc(), yyguts_t::yy_buffer_stack, yyguts_t::yy_buffer_stack_max, yyguts_t::yy_buffer_stack_top, and YY_FATAL_ERROR.

Referenced by ast_yypush_buffer_state().

01889 {
01890    int num_to_alloc;
01891     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01892 
01893    if (!yyg->yy_buffer_stack) {
01894 
01895       /* First allocation is just for 2 elements, since we don't know if this
01896        * scanner will even need a stack. We use 2 instead of 1 to avoid an
01897        * immediate realloc on the next call.
01898          */
01899       num_to_alloc = 1;
01900       yyg->yy_buffer_stack = (struct yy_buffer_state**)ast_yyalloc
01901                         (num_to_alloc * sizeof(struct yy_buffer_state*)
01902                         , yyscanner);
01903       if ( ! yyg->yy_buffer_stack )
01904          YY_FATAL_ERROR( "out of dynamic memory in ast_yyensure_buffer_stack()" );
01905                           
01906       memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
01907             
01908       yyg->yy_buffer_stack_max = num_to_alloc;
01909       yyg->yy_buffer_stack_top = 0;
01910       return;
01911    }
01912 
01913    if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
01914 
01915       /* Increase the buffer to prepare for a possible push. */
01916       int grow_size = 8 /* arbitrary grow size */;
01917 
01918       num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
01919       yyg->yy_buffer_stack = (struct yy_buffer_state**)ast_yyrealloc
01920                         (yyg->yy_buffer_stack,
01921                         num_to_alloc * sizeof(struct yy_buffer_state*)
01922                         , yyscanner);
01923       if ( ! yyg->yy_buffer_stack )
01924          YY_FATAL_ERROR( "out of dynamic memory in ast_yyensure_buffer_stack()" );
01925 
01926       /* zero only the new slots.*/
01927       memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
01928       yyg->yy_buffer_stack_max = num_to_alloc;
01929    }
01930 }

int ast_yyerror ( const char *  s,
yyltype loc,
struct parse_io parseio 
)

Definition at line 2588 of file ast_expr2f.c.

References ast_log(), expr2_token_subst(), free, LOG_WARNING, parse_io::scanner, parse_io::string, YY_CURRENT_BUFFER_LVALUE, and yytext.

02589 {  
02590    struct yyguts_t * yyg = (struct yyguts_t*)(parseio->scanner);
02591    char spacebuf[8000]; /* best safe than sorry */
02592    char spacebuf2[8000]; /* best safe than sorry */
02593    int i=0;
02594    char *s2 = expr2_token_subst(s);
02595    spacebuf[0] = 0;
02596    
02597    for(i=0;i< (int)(yytext - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf);i++) spacebuf2[i] = ' ';  /* uh... assuming yyg is defined, then I can use the yycolumn macro,
02598                                                                         which is the same thing as... get this:
02599                                        yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]->yy_bs_column
02600                                        I was tempted to just use yy_buf_pos in the STATE, but..., well:
02601                                           a. the yy_buf_pos is the current position in the buffer, which
02602                                              may not relate to the entire string/buffer because of the
02603                                              buffering.
02604                                           b. but, analysis of the situation is that when you use the
02605                                              ast_yy_scan_string func, it creates a single buffer the size of
02606                                              string, so the two would be the same... 
02607                                        so, in the end, the yycolumn macro is available, shorter, therefore easier. */
02608    spacebuf2[i++]='^';
02609    spacebuf2[i]= 0;
02610 
02611 #ifdef STANDALONE3
02612    /* easier to read in the standalone version */
02613    printf("ast_yyerror(): %s syntax error: %s; Input:\n%s\n%s\n",  
02614          (extra_error_message_supplied?extra_error_message:""), s2, parseio->string,spacebuf2);
02615 #else
02616    ast_log(LOG_WARNING,"ast_yyerror(): %s syntax error: %s; Input:\n%s\n%s\n",  
02617          (extra_error_message_supplied?extra_error_message:""), s2, parseio->string,spacebuf2);
02618 #endif
02619 #ifndef STANDALONE
02620    ast_log(LOG_WARNING,"If you have questions, please refer to https://wiki.asterisk.org/wiki/display/AST/Channel+Variables\n");
02621 #endif
02622    free(s2);
02623    return(0);
02624 }

int ast_yyerror ( const char *  ,
YYLTYPE ,
struct parse_io  
)

void ast_yyfree ( void *  ,
yyscan_t  yyscanner 
)

Definition at line 2398 of file ast_expr2f.c.

References free.

Referenced by ast_yylex_destroy().

02399 {
02400     /* the normal generated ast_yyfree func just frees its first arg;
02401      this get complaints on some systems, as sometimes this
02402      arg is a nil ptr! It's usually not fatal, but is irritating! */
02403    free( (char *) ptr );
02404 }

int ast_yyget_column ( yyscan_t  yyscanner  ) 

Get the current column number.

Parameters:
yyscanner The scanner object.

Definition at line 2072 of file ast_expr2f.c.

References YY_CURRENT_BUFFER, and yycolumn.

02073 {
02074     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02075     
02076         if (! YY_CURRENT_BUFFER)
02077             return 0;
02078     
02079     return yycolumn;
02080 }

int ast_yyget_debug ( yyscan_t  yyscanner  ) 

Definition at line 2177 of file ast_expr2f.c.

References yy_flex_debug.

02178 {
02179     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02180     return yy_flex_debug;
02181 }

YY_EXTRA_TYPE ast_yyget_extra ( yyscan_t  yyscanner  ) 

Get the user-defined data for this scanner.

Parameters:
yyscanner The scanner object.

Definition at line 2050 of file ast_expr2f.c.

References yyextra.

02051 {
02052     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02053     return yyextra;
02054 }

FILE * ast_yyget_in ( yyscan_t  yyscanner  ) 

Get the input stream.

Parameters:
yyscanner The scanner object.

Definition at line 2085 of file ast_expr2f.c.

References yyin.

02086 {
02087     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02088     return yyin;
02089 }

int ast_yyget_leng ( yyscan_t  yyscanner  ) 

Get the length of the current token.

Parameters:
yyscanner The scanner object.

Definition at line 2103 of file ast_expr2f.c.

References yyleng.

02104 {
02105     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02106     return yyleng;
02107 }

int ast_yyget_lineno ( yyscan_t  yyscanner  ) 

Get the current line number.

Parameters:
yyscanner The scanner object.

Definition at line 2059 of file ast_expr2f.c.

References YY_CURRENT_BUFFER, and yylineno.

02060 {
02061     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02062     
02063         if (! YY_CURRENT_BUFFER)
02064             return 0;
02065     
02066     return yylineno;
02067 }

YYLTYPE * ast_yyget_lloc ( yyscan_t  yyscanner  ) 

Definition at line 2203 of file ast_expr2f.c.

References yylloc.

02204 {
02205     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02206     return yylloc;
02207 }

YYSTYPE * ast_yyget_lval ( yyscan_t  yyscanner  ) 

Definition at line 2191 of file ast_expr2f.c.

References yylval.

02192 {
02193     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02194     return yylval;
02195 }

FILE * ast_yyget_out ( yyscan_t  yyscanner  ) 

Get the output stream.

Parameters:
yyscanner The scanner object.

Definition at line 2094 of file ast_expr2f.c.

References yyout.

02095 {
02096     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02097     return yyout;
02098 }

char * ast_yyget_text ( yyscan_t  yyscanner  ) 

Get the current token.

Parameters:
yyscanner The scanner object.

Definition at line 2113 of file ast_expr2f.c.

References yytext.

02114 {
02115     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02116     return yytext;
02117 }

int ast_yylex ( YYSTYPE yylval_param,
YYLTYPE yylloc_param,
yyscan_t  yyscanner 
)

int ast_yylex_destroy ( yyscan_t  yyscanner  ) 

Definition at line 2313 of file ast_expr2f.c.

References ast_yy_delete_buffer(), ast_yyfree(), ast_yypop_buffer_state(), yyguts_t::yy_buffer_stack, YY_CURRENT_BUFFER, YY_CURRENT_BUFFER_LVALUE, yy_init_globals(), and yyguts_t::yy_start_stack.

Referenced by ast_expr(), and ast_str_expr().

02314 {
02315     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02316 
02317     /* Pop the buffer stack, destroying each element. */
02318    while(YY_CURRENT_BUFFER){
02319       ast_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
02320       YY_CURRENT_BUFFER_LVALUE = NULL;
02321       ast_yypop_buffer_state(yyscanner);
02322    }
02323 
02324    /* Destroy the stack itself. */
02325    ast_yyfree(yyg->yy_buffer_stack ,yyscanner);
02326    yyg->yy_buffer_stack = NULL;
02327 
02328     /* Destroy the start condition stack. */
02329         ast_yyfree(yyg->yy_start_stack ,yyscanner );
02330         yyg->yy_start_stack = NULL;
02331 
02332     /* Reset the globals. This is important in a non-reentrant scanner so the next time
02333      * ast_yylex() is called, initialization will occur. */
02334     yy_init_globals( yyscanner);
02335 
02336     /* Destroy the main struct (reentrant only). */
02337     ast_yyfree ( yyscanner , yyscanner );
02338     yyscanner = NULL;
02339     return 0;
02340 }

int ast_yylex_init ( yyscan_t scanner  ) 

Definition at line 2222 of file ast_expr2f.c.

References ast_yyalloc(), errno, and yy_init_globals().

Referenced by ast_expr(), and ast_str_expr().

02224 {
02225     if (ptr_yy_globals == NULL){
02226         errno = EINVAL;
02227         return 1;
02228     }
02229 
02230     *ptr_yy_globals = (yyscan_t) ast_yyalloc ( sizeof( struct yyguts_t ), NULL );
02231 
02232     if (*ptr_yy_globals == NULL){
02233         errno = ENOMEM;
02234         return 1;
02235     }
02236 
02237     /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
02238     memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
02239 
02240     return yy_init_globals ( *ptr_yy_globals );
02241 }

int ast_yylex_init_extra ( YY_EXTRA_TYPE  user_defined,
yyscan_t scanner 
)

Definition at line 2251 of file ast_expr2f.c.

References ast_yyalloc(), ast_yyset_extra(), errno, and yy_init_globals().

02253 {
02254     struct yyguts_t dummy_yyguts;
02255 
02256     ast_yyset_extra (yy_user_defined, &dummy_yyguts);
02257 
02258     if (ptr_yy_globals == NULL){
02259         errno = EINVAL;
02260         return 1;
02261     }
02262    
02263     *ptr_yy_globals = (yyscan_t) ast_yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
02264    
02265     if (*ptr_yy_globals == NULL){
02266         errno = ENOMEM;
02267         return 1;
02268     }
02269     
02270     /* By setting to 0xAA, we expose bugs in
02271     yy_init_globals. Leave at 0x00 for releases. */
02272     memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
02273     
02274     ast_yyset_extra (yy_user_defined, *ptr_yy_globals);
02275     
02276     return yy_init_globals ( *ptr_yy_globals );
02277 }

int ast_yyparse ( void *   ) 

Referenced by ast_expr(), and ast_str_expr().

void ast_yypop_buffer_state ( yyscan_t  yyscanner  ) 

Removes and deletes the top of the stack, if present. The next element becomes the new top.

Parameters:
yyscanner The scanner object.

Definition at line 1868 of file ast_expr2f.c.

References ast_yy_delete_buffer(), ast_yy_load_buffer_state(), yyguts_t::yy_buffer_stack_top, YY_CURRENT_BUFFER, YY_CURRENT_BUFFER_LVALUE, and yyguts_t::yy_did_buffer_switch_on_eof.

Referenced by ast_yylex_destroy().

01869 {
01870     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01871    if (!YY_CURRENT_BUFFER)
01872       return;
01873 
01874    ast_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner);
01875    YY_CURRENT_BUFFER_LVALUE = NULL;
01876    if (yyg->yy_buffer_stack_top > 0)
01877       --yyg->yy_buffer_stack_top;
01878 
01879    if (YY_CURRENT_BUFFER) {
01880       ast_yy_load_buffer_state(yyscanner );
01881       yyg->yy_did_buffer_switch_on_eof = 1;
01882    }
01883 }

void ast_yypush_buffer_state ( YY_BUFFER_STATE  new_buffer,
yyscan_t  yyscanner 
)

Pushes the new state onto the stack. The new state becomes the current state. This function will allocate the stack if necessary.

Parameters:
new_buffer The new state.
yyscanner The scanner object.

Definition at line 1837 of file ast_expr2f.c.

References ast_yy_load_buffer_state(), ast_yyensure_buffer_stack(), yyguts_t::yy_buffer_stack_top, yyguts_t::yy_c_buf_p, YY_CURRENT_BUFFER, YY_CURRENT_BUFFER_LVALUE, yyguts_t::yy_did_buffer_switch_on_eof, yyguts_t::yy_hold_char, and yyguts_t::yy_n_chars.

01838 {
01839     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01840    if (new_buffer == NULL)
01841       return;
01842 
01843    ast_yyensure_buffer_stack(yyscanner);
01844 
01845    /* This block is copied from ast_yy_switch_to_buffer. */
01846    if ( YY_CURRENT_BUFFER )
01847       {
01848       /* Flush out information for old buffer. */
01849       *yyg->yy_c_buf_p = yyg->yy_hold_char;
01850       YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
01851       YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
01852       }
01853 
01854    /* Only push if top exists. Otherwise, replace top. */
01855    if (YY_CURRENT_BUFFER)
01856       yyg->yy_buffer_stack_top++;
01857    YY_CURRENT_BUFFER_LVALUE = new_buffer;
01858 
01859    /* copied from ast_yy_switch_to_buffer. */
01860    ast_yy_load_buffer_state(yyscanner );
01861    yyg->yy_did_buffer_switch_on_eof = 1;
01862 }

void * ast_yyrealloc ( void *  ,
yy_size_t  ,
yyscan_t  yyscanner 
)

Definition at line 2371 of file ast_expr2f.c.

References realloc.

Referenced by ast_yyensure_buffer_stack().

02372 {
02373    /* The cast to (char *) in the following accommodates both
02374     * implementations that use char* generic pointers, and those
02375     * that use void* generic pointers.  It works with the latter
02376     * because both ANSI C and C++ allow castless assignment from
02377     * any pointer type to void*, and deal with argument conversions
02378     * as though doing an assignment.
02379     */
02380    return (void *) realloc( (char *) ptr, size );
02381 }

void ast_yyrestart ( FILE *  input_file,
yyscan_t  yyscanner 
)

void ast_yyset_column ( int  column_no,
yyscan_t  yyscanner 
)

Set the current column.

Parameters:
line_number 
yyscanner The scanner object.

Definition at line 2148 of file ast_expr2f.c.

References YY_CURRENT_BUFFER, yy_fatal_error(), and yycolumn.

02149 {
02150     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02151 
02152         /* column is only valid if an input buffer exists. */
02153         if (! YY_CURRENT_BUFFER )
02154            yy_fatal_error( "ast_yyset_column called with no buffer" , yyscanner); 
02155     
02156     yycolumn = column_no;
02157 }

void ast_yyset_debug ( int  debug_flag,
yyscan_t  yyscanner 
)

Definition at line 2183 of file ast_expr2f.c.

References yy_flex_debug.

02184 {
02185     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02186     yy_flex_debug = bdebug ;
02187 }

void ast_yyset_extra ( YY_EXTRA_TYPE  user_defined,
yyscan_t  yyscanner 
)

Set the user-defined data. This data is never touched by the scanner.

Parameters:
user_defined The data to be associated with this scanner.
yyscanner The scanner object.

Definition at line 2123 of file ast_expr2f.c.

References yyextra.

Referenced by ast_yylex_init_extra().

02124 {
02125     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02126     yyextra = user_defined ;
02127 }

void ast_yyset_in ( FILE *  in_str,
yyscan_t  yyscanner 
)

Set the input stream. This does not discard the current input buffer.

Parameters:
in_str A readable stream.
yyscanner The scanner object.
See also:
ast_yy_switch_to_buffer

Definition at line 2165 of file ast_expr2f.c.

References yyin.

02166 {
02167     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02168     yyin = in_str ;
02169 }

void ast_yyset_lineno ( int  line_number,
yyscan_t  yyscanner 
)

Set the current line number.

Parameters:
line_number 
yyscanner The scanner object.

Definition at line 2133 of file ast_expr2f.c.

References YY_CURRENT_BUFFER, yy_fatal_error(), and yylineno.

02134 {
02135     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02136 
02137         /* lineno is only valid if an input buffer exists. */
02138         if (! YY_CURRENT_BUFFER )
02139            yy_fatal_error( "ast_yyset_lineno called with no buffer" , yyscanner); 
02140     
02141     yylineno = line_number;
02142 }

void ast_yyset_lloc ( YYLTYPE yylloc_param,
yyscan_t  yyscanner 
)

Definition at line 2209 of file ast_expr2f.c.

References yylloc.

02210 {
02211     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02212     yylloc = yylloc_param;
02213 }

void ast_yyset_lval ( YYSTYPE yylval_param,
yyscan_t  yyscanner 
)

Definition at line 2197 of file ast_expr2f.c.

References yylval.

02198 {
02199     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02200     yylval = yylval_param;
02201 }

void ast_yyset_out ( FILE *  out_str,
yyscan_t  yyscanner 
)

Definition at line 2171 of file ast_expr2f.c.

References yyout.

02172 {
02173     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02174     yyout = out_str ;
02175 }

static char * expr2_token_subst ( const char *  mess  )  [static]

Definition at line 2544 of file ast_expr2f.c.

References len(), and malloc.

Referenced by ast_yyerror().

02545 {
02546    /* calc a length, malloc, fill, and return; yyerror had better free it! */
02547    int len=0,i;
02548    const char *p;
02549    char *res, *s;
02550    const char *t;
02551    int expr2_token_equivs_entries = sizeof(expr2_token_equivs1)/sizeof(char*);
02552 
02553    for (p=mess; *p; p++) {
02554       for (i=0; i<expr2_token_equivs_entries; i++) {
02555          if ( strncmp(p,expr2_token_equivs1[i],strlen(expr2_token_equivs1[i])) == 0 )
02556          {
02557             len+=strlen(expr2_token_equivs2[i])+2;
02558             p += strlen(expr2_token_equivs1[i])-1;
02559             break;
02560          }
02561       }
02562       len++;
02563    }
02564    res = (char*)malloc(len+1);
02565    res[0] = 0;
02566    s = res;
02567    for (p=mess; *p;) {
02568       int found = 0;
02569       for (i=0; i<expr2_token_equivs_entries; i++) {
02570          if ( strncmp(p,expr2_token_equivs1[i],strlen(expr2_token_equivs1[i])) == 0 ) {
02571             *s++ = '\'';
02572             for (t=expr2_token_equivs2[i]; *t;) {
02573                *s++ = *t++;
02574             }
02575             *s++ = '\'';
02576             p += strlen(expr2_token_equivs1[i]);
02577             found = 1;
02578             break;
02579          }
02580       }
02581       if( !found )
02582          *s++ = *p++;
02583    }
02584    *s++ = 0;
02585    return res;
02586 }

static int input ( yyscan_t  yyscanner  )  [static]

Referenced by eivr_comm().

static void yy_fatal_error ( yyconst char *  msg,
yyscan_t  yyscanner 
) [static]

Definition at line 2022 of file ast_expr2f.c.

References YY_EXIT_FAILURE.

02023 {
02024       (void) fprintf( stderr, "%s\n", msg );
02025    exit( YY_EXIT_FAILURE );
02026 }

static void yy_fatal_error ( yyconst char  msg[],
yyscan_t  yyscanner 
) [static]

Referenced by ast_yyset_column(), and ast_yyset_lineno().

static int yy_get_next_buffer ( yyscan_t  yyscanner  )  [static]

static yy_state_type yy_get_previous_state ( yyscan_t  yyscanner  )  [static]

static int yy_init_globals ( yyscan_t  yyscanner  )  [static]

Definition at line 2279 of file ast_expr2f.c.

References yyguts_t::yy_buffer_stack, yyguts_t::yy_buffer_stack_max, yyguts_t::yy_buffer_stack_top, yyguts_t::yy_c_buf_p, yyguts_t::yy_init, yyguts_t::yy_start, yyguts_t::yy_start_stack, yyguts_t::yy_start_stack_depth, yyguts_t::yy_start_stack_ptr, yyin, and yyout.

Referenced by ast_yylex_destroy(), ast_yylex_init(), and ast_yylex_init_extra().

02280 {
02281     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02282     /* Initialization is the same as for the non-reentrant scanner.
02283      * This function is called from ast_yylex_destroy(), so don't allocate here.
02284      */
02285 
02286     yyg->yy_buffer_stack = 0;
02287     yyg->yy_buffer_stack_top = 0;
02288     yyg->yy_buffer_stack_max = 0;
02289     yyg->yy_c_buf_p = (char *) 0;
02290     yyg->yy_init = 0;
02291     yyg->yy_start = 0;
02292 
02293     yyg->yy_start_stack_ptr = 0;
02294     yyg->yy_start_stack_depth = 0;
02295     yyg->yy_start_stack =  NULL;
02296 
02297 /* Defined in main.c */
02298 #ifdef YY_STDINIT
02299     yyin = stdin;
02300     yyout = stdout;
02301 #else
02302     yyin = (FILE *) 0;
02303     yyout = (FILE *) 0;
02304 #endif
02305 
02306     /* For future reference: Set errno on error, since we are called by
02307      * ast_yylex_init()
02308      */
02309     return 0;
02310 }

static yy_state_type yy_try_NUL_trans ( yy_state_type  current_state,
yyscan_t  yyscanner 
) [static]

static void yyunput ( int  c,
char *  buf_ptr,
yyscan_t  yyscanner 
) [static]


Variable Documentation

int curlycount = 0 [static]

Definition at line 609 of file ast_expr2f.c.

const char* const expr2_token_equivs1[] [static]

Definition at line 2491 of file ast_expr2f.c.

const char* const expr2_token_equivs2[] [static]

Definition at line 2517 of file ast_expr2f.c.

char extra_error_message[4095]

Definition at line 2474 of file ast_expr2f.c.

int extra_error_message_supplied = 0

Definition at line 2475 of file ast_expr2f.c.

yyconst flex_int16_t yy_accept[63] [static]

Definition at line 373 of file ast_expr2f.c.

yyconst flex_int16_t yy_base[70] [static]

Definition at line 423 of file ast_expr2f.c.

yyconst flex_int16_t yy_chk[159] [static]

Definition at line 466 of file ast_expr2f.c.

yyconst flex_int16_t yy_def[70] [static]

Definition at line 434 of file ast_expr2f.c.

yyconst flex_int32_t yy_ec[256] [static]

Definition at line 384 of file ast_expr2f.c.

yyconst flex_int32_t yy_meta[29] [static]

Definition at line 416 of file ast_expr2f.c.

yyconst flex_int16_t yy_nxt[159] [static]

Definition at line 445 of file ast_expr2f.c.


Generated on Mon Mar 19 11:30:36 2012 for Asterisk - The Open Source Telephony Project by  doxygen 1.4.7