Asterisk - The Open Source Telephony Project GIT-master-f36a736
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
ael_structs.h File Reference

Structures for AEL - the Asterisk extension language. More...

#include "asterisk/paths.h"
#include "pval.h"
Include dependency graph for ael_structs.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ael_extension
 
struct  ael_priority
 
struct  parse_io
 

Macros

#define QUAD_MAX   (0x7fffffffffffffffLL)
 
#define QUAD_MIN   (-0x7fffffffffffffffLL-1)
 
#define YY_TYPEDEF_YY_SCANNER_T
 

Typedefs

typedef void * yyscan_t
 

Enumerations

enum  ael_priority_type {
  AEL_APPCALL , AEL_CONTROL1 , AEL_FOR_CONTROL , AEL_IF_CONTROL ,
  AEL_IFTIME_CONTROL , AEL_RAND_CONTROL , AEL_LABEL , AEL_RETURN
}
 

Functions

struct pvalael2_parse (char *fname, int *errs)
 
void ael2_print (char *fname, pval *tree)
 
void ael2_semantic_check (pval *item, int *errs, int *warns, int *notes)
 
void destroy_pval (pval *item)
 
pvallinku1 (pval *head, pval *tail)
 
pvalnpval (pvaltype type, int first_line, int last_line, int first_column, int last_column)
 

Variables

char * prev_word
 

Detailed Description

Structures for AEL - the Asterisk extension language.

pbx_ael.c

Todo:
document this file (ael.h)

Definition in file ael_structs.h.

Macro Definition Documentation

◆ QUAD_MAX

#define QUAD_MAX   (0x7fffffffffffffffLL)

Definition at line 54 of file ael_structs.h.

◆ QUAD_MIN

#define QUAD_MIN   (-0x7fffffffffffffffLL-1)

Definition at line 51 of file ael_structs.h.

◆ YY_TYPEDEF_YY_SCANNER_T

#define YY_TYPEDEF_YY_SCANNER_T

Definition at line 70 of file ael_structs.h.

Typedef Documentation

◆ yyscan_t

typedef void* yyscan_t

Definition at line 71 of file ael_structs.h.

Enumeration Type Documentation

◆ ael_priority_type

Enumerator
AEL_APPCALL 
AEL_CONTROL1 
AEL_FOR_CONTROL 
AEL_IF_CONTROL 
AEL_IFTIME_CONTROL 
AEL_RAND_CONTROL 
AEL_LABEL 
AEL_RETURN 

Definition at line 84 of file ael_structs.h.

ael_priority_type
Definition: ael_structs.h:84
@ AEL_FOR_CONTROL
Definition: ael_structs.h:84
@ AEL_RAND_CONTROL
Definition: ael_structs.h:84
@ AEL_RETURN
Definition: ael_structs.h:84
@ AEL_IF_CONTROL
Definition: ael_structs.h:84
@ AEL_IFTIME_CONTROL
Definition: ael_structs.h:84
@ AEL_CONTROL1
Definition: ael_structs.h:84
@ AEL_LABEL
Definition: ael_structs.h:84
@ AEL_APPCALL
Definition: ael_structs.h:84

Function Documentation

◆ ael2_parse()

struct pval * ael2_parse ( char *  fname,
int *  errs 
)

Definition at line 3344 of file ael_lex.c.

3345{
3346 struct pval *pvalue;
3347 struct parse_io *io;
3348 char *buffer;
3349 struct stat stats;
3350 FILE *fin;
3351
3352 /* extern int ael_yydebug; */
3353
3354 io = calloc(sizeof(struct parse_io),1);
3355 /* reset the global counters */
3356 prev_word = 0;
3357 my_lineno = 1;
3359 my_col = 0;
3360 /* ael_yydebug = 1; */
3361 ael_yylex_init(&io->scanner);
3362 fin = fopen(filename,"r");
3363 if ( !fin ) {
3364 ast_log(LOG_ERROR,"File %s could not be opened\n", filename);
3365 *errors = 1;
3366 return 0;
3367 }
3368 if (my_file)
3369 free(my_file);
3370 my_file = strdup(filename);
3371 if (stat(filename, &stats)) {
3372 ast_log(LOG_WARNING, "failed to populate stats from file '%s'\n", filename);
3373 }
3374 buffer = (char*)malloc(stats.st_size+2);
3375 if (fread(buffer, 1, stats.st_size, fin) != stats.st_size) {
3376 ast_log(LOG_ERROR, "fread() failed: %s\n", strerror(errno));
3377 }
3378 buffer[stats.st_size]=0;
3379 fclose(fin);
3380
3381 ael_yy_scan_string (buffer ,io->scanner);
3382 ael_yyset_lineno(1 , io->scanner);
3383
3384 /* ael_yyset_in (fin , io->scanner); OLD WAY */
3385
3386 ael_yyparse(io);
3387
3388
3389 pvalue = io->pval;
3390 *errors = io->syntax_error_count;
3391
3392 ael_yylex_destroy(io->scanner);
3393 free(buffer);
3394 free(io);
3395
3396 return pvalue;
3397}
static int my_col
Definition: ael_lex.c:876
char * prev_word
Definition: ael_lex.c:878
static int my_lineno
Definition: ael_lex.c:875
char * my_file
Definition: ael_lex.c:877
int ael_yyparse(struct parse_io *)
int ael_yylex_destroy(yyscan_t yyscanner)
Definition: ael_lex.c:3145
YY_BUFFER_STATE ael_yy_scan_string(yyconst char *yy_str, yyscan_t yyscanner)
Definition: ael_lex.c:2807
int ael_yylex_init(yyscan_t *scanner)
Definition: ael_lex.c:3054
static int include_stack_index
Definition: ael_lex.c:908
void ael_yyset_lineno(int line_number, yyscan_t yyscanner)
Definition: ael_lex.c:2965
#define strdup(a)
Definition: astmm.h:163
#define calloc(a, b)
Definition: astmm.h:155
#define ast_log
Definition: astobj2.c:42
static struct io_context * io
Definition: chan_ooh323.c:401
char * malloc()
void free()
#define LOG_ERROR
#define LOG_WARNING
int errno
Definition: pval.h:49

References ael_yy_scan_string(), ael_yylex_destroy(), ael_yylex_init(), ael_yyparse(), ael_yyset_lineno(), ast_log, calloc, errno, free(), include_stack_index, io, LOG_ERROR, LOG_WARNING, malloc(), my_col, my_file, my_lineno, prev_word, and strdup.

Referenced by pbx_load_module().

◆ ael2_print()

void ael2_print ( char *  fname,
pval tree 
)

Definition at line 382 of file pval.c.

383{
384 FILE *fin = fopen(fname,"w");
385 if ( !fin ) {
386 ast_log(LOG_ERROR, "Couldn't open %s for writing.\n", fname);
387 return;
388 }
389 print_pval_list(fin, tree, 0);
390 fclose(fin);
391}
static void print_pval_list(FILE *fin, pval *item, int depth)
Definition: pval.c:373

References ast_log, LOG_ERROR, and print_pval_list().

◆ ael2_semantic_check()

void ael2_semantic_check ( pval item,
int *  errs,
int *  warns,
int *  notes 
)

Definition at line 2885 of file pval.c.

2886{
2887
2888#ifdef AAL_ARGCHECK
2889 int argapp_errs =0;
2890 char *rfilename;
2891#endif
2892 struct argapp *apps=0;
2893
2894 if (!item)
2895 return; /* don't check an empty tree */
2896#ifdef AAL_ARGCHECK
2897 rfilename = ast_alloca(10 + strlen(ast_config_AST_VAR_DIR));
2898 sprintf(rfilename, "%s/applist", ast_config_AST_VAR_DIR);
2899
2900 apps = argdesc_parse(rfilename, &argapp_errs); /* giveth */
2901#endif
2902 current_db = item;
2903 errs = warns = notes = 0;
2904
2906 check_pval(item, apps, 0);
2907
2908#ifdef AAL_ARGCHECK
2909 argdesc_destroy(apps); /* taketh away */
2910#endif
2911 current_db = 0;
2912
2913 *arg_errs = errs;
2914 *arg_warns = warns;
2915 *arg_notes = notes;
2916}
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
Definition: astmm.h:288
const char * ast_config_AST_VAR_DIR
Definition: options.c:157
static pval * current_db
Definition: pval.c:72
static int notes
Definition: pval.c:66
static int warns
Definition: pval.c:65
static int errs
Definition: pval.c:65
void check_pval(pval *item, struct argapp *apps, int in_globals)
Definition: pval.c:2865
static void check_context_names(void)
Definition: pval.c:2310
Registered applications container.
Definition: pbx_app.c:67
Definition: pval.h:111
static struct aco_type item
Definition: test_config.c:1463

References ast_alloca, ast_config_AST_VAR_DIR, check_context_names(), check_pval(), current_db, errs, item, notes, and warns.

Referenced by pbx_load_module().

◆ destroy_pval()

void destroy_pval ( pval item)

Definition at line 4940 of file pval.c.

4941{
4942 pval *i,*nxt;
4943
4944 for (i=item; i; i=nxt) {
4945 nxt = i->next;
4946
4948 }
4949}
void destroy_pval_item(pval *item)
Definition: pval.c:4672
struct pval * next
Definition: pval.h:93

References destroy_pval_item(), item, and pval::next.

Referenced by yydestruct(), and yyparse().

◆ linku1()

pval * linku1 ( pval head,
pval tail 
)

Definition at line 5922 of file pval.c.

5923{
5924 if (!head)
5925 return tail;
5926 if (tail) {
5927 if (!head->next) {
5928 head->next = tail;
5929 } else {
5930 head->u1_last->next = tail;
5931 }
5932 head->u1_last = tail;
5933 tail->prev = head; /* the dad link only points to containers */
5934 }
5935 return head;
5936}
struct pval * u1_last
Definition: pval.h:64
struct pval * prev
Definition: pval.h:97

References pval::next, pval::prev, and pval::u1_last.

◆ npval()

struct pval * npval ( pvaltype  type,
int  first_line,
int  last_line,
int  first_column,
int  last_column 
)

Definition at line 3965 of file ael.tab.c.

3967{
3968 pval *z = calloc(1, sizeof(struct pval));
3969 z->type = type;
3970 z->startline = first_line;
3971 z->endline = last_line;
3972 z->startcol = first_column;
3973 z->endcol = last_column;
3974 z->filename = strdup(S_OR(my_file, "<none>"));
3975 return z;
3976}
char * my_file
Definition: ael_lex.c:877
static const char type[]
Definition: chan_ooh323.c:109
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one.
Definition: strings.h:80
int endline
Definition: pval.h:52
int startcol
Definition: pval.h:53
int endcol
Definition: pval.h:54
pvaltype type
Definition: pval.h:50
char * filename
Definition: pval.h:55
int startline
Definition: pval.h:51

References calloc, pval::endcol, pval::endline, pval::filename, my_file, S_OR, pval::startcol, pval::startline, strdup, type, and pval::type.

Referenced by npval2(), and yyparse().

Variable Documentation

◆ prev_word

char* prev_word
extern

Definition at line 878 of file ael_lex.c.

Referenced by ael2_parse(), c_prevword(), while(), yydestruct(), and yyparse().