whitespace-only change:

fix formatting and indentation of the flex file,
and regenerate the ael_lex.c



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@22571 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Luigi Rizzo
2006-04-26 18:40:09 +00:00
parent 2bde492ea9
commit 2de9dcb345
2 changed files with 867 additions and 820 deletions

View File

@@ -52,12 +52,11 @@ static int pbcpop(char x);
static void pbcwhere(char *text, int *line, int *col ); static void pbcwhere(char *text, int *line, int *col );
static int c_prevword(void); static int c_prevword(void);
struct stackelement struct stackelement {
{ char *fname;
char *fname; int lineno;
int lineno; int colno;
int colno; YY_BUFFER_STATE bufstate;
YY_BUFFER_STATE bufstate;
}; };
struct stackelement include_stack[MAX_INCLUDE_DEPTH]; struct stackelement include_stack[MAX_INCLUDE_DEPTH];
int include_stack_index = 0; int include_stack_index = 0;
@@ -120,352 +119,384 @@ includes {yylloc->first_line = yylloc->last_line = my_lineno; yylloc->last_colum
[ ]+ {/* nothing */ int wid = 8-(my_col%8); my_col+=wid;} [ ]+ {/* nothing */ int wid = 8-(my_col%8); my_col+=wid;}
[-a-zA-Z0-9'"_/.\<\>\*\+!$#\[\]][-a-zA-Z0-9'"_/.!\*\+\<\>\{\}$#\[\]]* { [-a-zA-Z0-9'"_/.\<\>\*\+!$#\[\]][-a-zA-Z0-9'"_/.!\*\+\<\>\{\}$#\[\]]* {
yylloc->first_line = yylloc->last_line = my_lineno;yylloc->last_column=my_col+yyleng-1; yylloc->first_column=my_col; /* set up the ptr */ yylloc->first_line = yylloc->last_line = my_lineno;
yylval->str = strdup(yytext); yylloc->last_column=my_col+yyleng-1;
/* printf("\nGot WORD %s[%d][%d:%d]\n", yylval->str, my_lineno ,yylloc->first_column,yylloc->last_column ); */ yylloc->first_column=my_col; /* set up the ptr */
my_col+=yyleng; my_col+=yyleng;
prev_word = yylval->str; yylval->str = strdup(yytext);
return word; /* printf("\nGot WORD %s[%d][%d:%d]\n", yylval->str, my_lineno ,yylloc->first_column,yylloc->last_column ); */
} prev_word = yylval->str;
return word;
}
<paren>[^()\[\]\{\}]*\) {yylloc->first_line = my_lineno; yylloc->first_column=my_col; <paren>[^()\[\]\{\}]*\) {
if ( pbcpop(')') ) { yylloc->first_line = my_lineno;
/* error */ yylloc->first_column=my_col;
int l4,c4; if ( pbcpop(')') ) {
pbcwhere(yytext, &l4, &c4); /* error */
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ')' in expression: %s !\n", my_file, my_lineno+l4, c4, yytext); int l4,c4;
BEGIN(0); pbcwhere(yytext, &l4, &c4);
yylloc->last_line = my_lineno+l4; ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ')' in expression: %s !\n", my_file, my_lineno+l4, c4, yytext);
yylloc->last_column=c4; BEGIN(0);
my_col=c4; yylloc->last_line = my_lineno+l4;
my_lineno += l4; yylloc->last_column=c4;
yylval->str = strdup(yytext); my_col=c4;
prev_word = 0; my_lineno += l4;
return word; yylval->str = strdup(yytext);
} prev_word = 0;
parencount--; return word;
if ( parencount >= 0) { }
yymore(); parencount--;
} else { if ( parencount >= 0) {
int l4,c4; yymore();
pbcwhere(yytext, &l4, &c4); } else {
yylloc->last_line = my_lineno+l4; int l4,c4;
yylloc->last_column=c4; pbcwhere(yytext, &l4, &c4);
yylval->str = strdup(yytext); yylloc->last_line = my_lineno+l4;
*(yylval->str+strlen(yylval->str)-1)=0; yylloc->last_column=c4;
/* printf("Got paren word %s\n", yylval->str); */ yylval->str = strdup(yytext);
unput(')'); *(yylval->str+strlen(yylval->str)-1)=0;
my_col=c4; /* printf("Got paren word %s\n", yylval->str); */
my_lineno += l4; unput(')');
BEGIN(0); my_col=c4;
return word; my_lineno += l4;
} BEGIN(0);
} return word;
}
}
<paren>[^()\[\]\{\}]*\( {
yylloc->first_line = my_lineno; yylloc->first_column=my_col;
parencount++;
pbcpush('(');
yymore();
}
<paren>[^()\[\]\{\}]*\( {yylloc->first_line = my_lineno; yylloc->first_column=my_col;
parencount++; pbcpush('(');
yymore();
}
<paren>[^()\[\]\{\}]*\[ {yylloc->first_line = my_lineno;yylloc->first_column=my_col; yymore(); pbcpush('['); } <paren>[^()\[\]\{\}]*\[ {yylloc->first_line = my_lineno;yylloc->first_column=my_col; yymore(); pbcpush('['); }
<paren>[^()\[\]\{\}]*\] {yylloc->first_line = my_lineno;yylloc->first_column=my_col;
if ( pbcpop(']') ) { <paren>[^()\[\]\{\}]*\] {
/* error */ yylloc->first_line = my_lineno;yylloc->first_column=my_col;
int l4,c4; if ( pbcpop(']') ) {
pbcwhere(yytext, &l4, &c4); /* error */
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ']' in expression!\n", my_file, my_lineno+l4, c4); int l4,c4;
BEGIN(0); pbcwhere(yytext, &l4, &c4);
yylloc->last_line = my_lineno+l4; ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ']' in expression!\n", my_file, my_lineno+l4, c4);
yylloc->last_column=c4; BEGIN(0);
my_col=c4; yylloc->last_line = my_lineno+l4;
my_lineno += l4; yylloc->last_column=c4;
yylval->str = strdup(yytext); my_col=c4;
return word; my_lineno += l4;
} yylval->str = strdup(yytext);
yymore(); return word;
} }
yymore();
}
<paren>[^()\[\]\{\}]*\{ {yylloc->first_line = my_lineno;yylloc->first_column=my_col; yymore(); pbcpush('{'); } <paren>[^()\[\]\{\}]*\{ {yylloc->first_line = my_lineno;yylloc->first_column=my_col; yymore(); pbcpush('{'); }
<paren>[^()\[\]\{\}]*\} {yylloc->first_line = my_lineno;
yylloc->first_column=my_col; <paren>[^()\[\]\{\}]*\} {
if ( pbcpop('}') ) { yylloc->first_line = my_lineno;
/* error */ yylloc->first_column=my_col;
int l4,c4; if ( pbcpop('}') ) {
pbcwhere(yytext, &l4, &c4); /* error */
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '}' in expression!\n", my_file, my_lineno+l4, c4); int l4,c4;
BEGIN(0); pbcwhere(yytext, &l4, &c4);
yylloc->last_line = my_lineno+l4; ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '}' in expression!\n", my_file, my_lineno+l4, c4);
yylloc->last_column=c4; BEGIN(0);
my_col=c4; yylloc->last_line = my_lineno+l4;
my_lineno += l4; yylloc->last_column=c4;
yylval->str = strdup(yytext); my_col=c4;
return word; my_lineno += l4;
} yylval->str = strdup(yytext);
yymore(); return word;
} }
yymore();
}
<argg>[^(),\{\}\[\]]*\) {
/* printf("ARGG:%s\n",yytext); */
int linecount = 0;
int colcount = my_col;
char *pt = yytext;
yylloc->first_line = my_lineno;
yylloc->first_column=my_col;
if ( pbcpop(')') ) {
/* error */
int l4,c4;
pbcwhere(yytext, &l4, &c4);
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ')' in expression!\n", my_file, my_lineno+l4, c4);
BEGIN(0);
yylloc->last_line = my_lineno+l4;
yylloc->last_column=c4;
my_col=c4;
my_lineno += l4;
yylval->str = strdup(yytext);
return word;
}
<argg>[^(),\{\}\[\]]*\) {/* printf("ARGG:%s\n",yytext); */ while (*pt) {
int linecount = 0; if (*pt == '\n') {
int colcount = my_col; linecount++;
char *pt = yytext; colcount=0;
}
pt++;
colcount++;
}
yylloc->last_line = my_lineno+linecount;
yylloc->last_column=colcount;
parencount--;
if( parencount >= 0){
yymore();
} else {
yylval->str = strdup(yytext);
if(yyleng > 1 )
*(yylval->str+yyleng-1)=0;
/* printf("Got argg word '%s'\n", yylval->str); */
BEGIN(0);
if ( !strcmp(yylval->str,")") ) {
free(yylval->str);
yylval->str = 0;
my_col+=1;
return RP;
} else {
unput(')');
my_col=colcount;
my_lineno+=linecount;
return word;
}
}
}
yylloc->first_line = my_lineno; <argg>[^(),\{\}\[\]]*\( {
yylloc->first_column=my_col; /* printf("ARGG:%s\n",yytext); */
if ( pbcpop(')') ) { /* printf("GOT AN LP!!!\n"); */
/* error */ yylloc->first_line = my_lineno;
int l4,c4; yylloc->first_column=my_col;
pbcwhere(yytext, &l4, &c4); parencount++;
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ')' in expression!\n", my_file, my_lineno+l4, c4); pbcpush('(');
BEGIN(0); yymore();
yylloc->last_line = my_lineno+l4; }
yylloc->last_column=c4;
my_col=c4;
my_lineno += l4;
yylval->str = strdup(yytext);
return word;
}
<argg>[^(),\{\}\[\]]*\, {
/* printf("ARGG:%s\n",yytext); */
if( parencount != 0) {
/* printf("Folding in a comma!\n"); */
yymore();
} else {
/* printf("got a comma!\n\n"); */
int linecount = 0;
int colcount = my_col;
char *pt;
while (*pt) { pt = yytext;
if (*pt == '\n') { while (*pt) {
linecount++; if ( *pt == '\n' ) {
colcount=0; linecount++;
} colcount=0;
pt++;
colcount++;
}
yylloc->last_line = my_lineno+linecount;
yylloc->last_column=colcount;
parencount--;
if( parencount >= 0){
yymore();
} else {
yylval->str = strdup(yytext);
if(yyleng > 1 )
*(yylval->str+yyleng-1)=0;
/* printf("Got argg word '%s'\n", yylval->str); */
BEGIN(0);
if ( !strcmp(yylval->str,")") ) {
free(yylval->str);
yylval->str = 0;
my_col+=1;
return RP;
} else {
unput(')');
my_col=colcount;
my_lineno+=linecount;
return word;
}
}
}
<argg>[^(),\{\}\[\]]*\( { /* printf("ARGG:%s\n",yytext); */
/* printf("GOT AN LP!!!\n"); */
yylloc->first_line = my_lineno;
yylloc->first_column=my_col;
parencount++;
pbcpush('(');
yymore();
}
<argg>[^(),\{\}\[\]]*\, { /* printf("ARGG:%s\n",yytext); */
if( parencount != 0) {
/* printf("Folding in a comma!\n"); */
yymore();
} else {
/* printf("got a comma!\n\n"); */
int linecount = 0;
int colcount = my_col;
char *pt;
pt = yytext;
while (*pt) {
if ( *pt == '\n' ) {
linecount++;
colcount=0;
}
pt++;
colcount++;
}
yylloc->first_line = my_lineno;
yylloc->last_line = my_lineno+linecount;
yylloc->last_column=colcount;
yylloc->first_column=my_col;
if( !commaout ) {
if( !strcmp(yytext,"," ) )
{commaout = 0; my_col+=1; return COMMA;}
yylval->str = strdup(yytext); /* printf("Got argg2 word %s\n", yylval->str); */
unput(',');
commaout = 1;
if(yyleng > 1 )
*(yylval->str+yyleng-1)=0;
my_lineno+=linecount;
my_col=colcount;
return word;
} else {
commaout = 0;
my_col+=1;
return COMMA;
}
}
} }
pt++;
<argg>[^(),\{\}\[\]]*\{ {/*printf("ARGG:%s\n",yytext);*/yylloc->first_line = my_lineno;yylloc->first_column=my_col; pbcpush('{'); yymore(); } colcount++;
<argg>[^(),\{\}\[\]]*\} {/*printf("ARGG:%s\n",yytext);*/yylloc->first_line = my_lineno;yylloc->first_column=my_col; }
if ( pbcpop('}') ) { yylloc->first_line = my_lineno;
/* error */ yylloc->last_line = my_lineno+linecount;
int l4,c4; yylloc->last_column=colcount;
pbcwhere(yytext, &l4, &c4); yylloc->first_column=my_col;
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '}' in expression!\n", my_file, my_lineno+l4, my_col+c4); if( !commaout ) {
BEGIN(0); if( !strcmp(yytext,"," ) ) {
yylloc->last_line = my_lineno+l4; commaout = 0;
yylloc->last_column=my_col+c4; my_col+=1;
my_col=c4; return COMMA;
my_lineno += l4;
yylval->str = strdup(yytext);
return word;
}
yymore();
} }
yylval->str = strdup(yytext); /* printf("Got argg2 word %s\n", yylval->str); */
unput(',');
commaout = 1;
if(yyleng > 1 )
*(yylval->str+yyleng-1)=0;
my_lineno+=linecount;
my_col=colcount;
return word;
} else {
commaout = 0;
my_col+=1;
return COMMA;
}
}
}
<argg>[^(),\{\}\[\]]*\{ {
/*printf("ARGG:%s\n",yytext);*/
yylloc->first_line = my_lineno;
yylloc->first_column=my_col;
pbcpush('{'); yymore();
}
<argg>[^(),\{\}\[\]]*\} {
/*printf("ARGG:%s\n",yytext);*/yylloc->first_line = my_lineno;yylloc->first_column=my_col;
if ( pbcpop('}') ) {
/* error */
int l4,c4;
pbcwhere(yytext, &l4, &c4);
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '}' in expression!\n", my_file, my_lineno+l4, my_col+c4);
BEGIN(0);
yylloc->last_line = my_lineno+l4;
yylloc->last_column=my_col+c4;
my_col=c4;
my_lineno += l4;
yylval->str = strdup(yytext);
return word;
}
yymore();
}
<argg>[^(),\{\}\[\]]*\[ {/*printf("ARGG:%s\n",yytext);*/yylloc->first_line = my_lineno;yylloc->first_column=my_col; yymore(); pbcpush('['); } <argg>[^(),\{\}\[\]]*\[ {/*printf("ARGG:%s\n",yytext);*/yylloc->first_line = my_lineno;yylloc->first_column=my_col; yymore(); pbcpush('['); }
<argg>[^(),\{\}\[\]]*\] {/*printf("ARGG:%s\n",yytext);*/yylloc->first_line = my_lineno;yylloc->first_column=my_col;
if ( pbcpop(']') ) {
/* error */
int l4,c4;
pbcwhere(yytext, &l4, &c4);
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ']' in expression!\n", my_file, my_lineno+l4, c4);
BEGIN(0);
yylloc->last_line = my_lineno+l4;
yylloc->last_column=c4;
my_col=c4;
my_lineno += l4;
yylval->str = strdup(yytext);
return word;
}
yymore();
}
<argg>[^(),\{\}\[\]]*\] {/*printf("ARGG:%s\n",yytext);*/yylloc->first_line = my_lineno;yylloc->first_column=my_col;
if ( pbcpop(']') ) {
/* error */
int l4,c4;
pbcwhere(yytext, &l4, &c4);
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ']' in expression!\n", my_file, my_lineno+l4, c4);
BEGIN(0);
yylloc->last_line = my_lineno+l4;
yylloc->last_column=c4;
my_col=c4;
my_lineno += l4;
yylval->str = strdup(yytext);
return word;
}
yymore();
}
<semic>[^;()\{\}\[\]]*\[ {/*printf("SEMIC:%s\n",yytext);*/yylloc->first_line = my_lineno;yylloc->first_column=my_col; yymore(); pbcpush('['); } <semic>[^;()\{\}\[\]]*\[ {/*printf("SEMIC:%s\n",yytext);*/yylloc->first_line = my_lineno;yylloc->first_column=my_col; yymore(); pbcpush('['); }
<semic>[^;()\{\}\[\]]*\] {/*printf("SEMIC:%s\n",yytext);*/yylloc->first_line = my_lineno;yylloc->first_column=my_col; <semic>[^;()\{\}\[\]]*\] {/*printf("SEMIC:%s\n",yytext);*/yylloc->first_line = my_lineno;yylloc->first_column=my_col;
if ( pbcpop(']') ) { if ( pbcpop(']') ) {
/* error */ /* error */
int l4,c4; int l4,c4;
pbcwhere(yytext, &l4, &c4); pbcwhere(yytext, &l4, &c4);
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ']' in expression!\n", my_file, my_lineno+l4, c4); ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ']' in expression!\n", my_file, my_lineno+l4, c4);
BEGIN(0); BEGIN(0);
yylloc->last_line = my_lineno+l4; yylloc->last_line = my_lineno+l4;
yylloc->last_column=c4; yylloc->last_column=c4;
my_col=c4; my_col=c4;
my_lineno += l4; my_lineno += l4;
yylval->str = strdup(yytext); yylval->str = strdup(yytext);
return word; return word;
} }
yymore();} yymore();
}
<semic>[^;()\{\}\[\]]*\{ {/*printf("SEMIC:%s\n",yytext);*/yylloc->first_line = my_lineno;yylloc->first_column=my_col; yymore(); pbcpush('{');} <semic>[^;()\{\}\[\]]*\{ {/*printf("SEMIC:%s\n",yytext);*/yylloc->first_line = my_lineno;yylloc->first_column=my_col; yymore(); pbcpush('{');}
<semic>[^;()\{\}\[\]]*\} {/*printf("SEMIC:%s\n",yytext);*/yylloc->first_line = my_lineno;yylloc->first_column=my_col; <semic>[^;()\{\}\[\]]*\} {/*printf("SEMIC:%s\n",yytext);*/yylloc->first_line = my_lineno;yylloc->first_column=my_col;
if ( pbcpop('}') ) { if ( pbcpop('}') ) {
/* error */ /* error */
int l4,c4; int l4,c4;
pbcwhere(yytext, &l4, &c4); pbcwhere(yytext, &l4, &c4);
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '}' in expression!\n", my_file, my_lineno+l4, my_col+c4); ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '}' in expression!\n", my_file, my_lineno+l4, my_col+c4);
BEGIN(0); BEGIN(0);
yylloc->last_line = my_lineno+l4; yylloc->last_line = my_lineno+l4;
yylloc->last_column=my_col+c4; yylloc->last_column=my_col+c4;
my_col=c4; my_col=c4;
my_lineno += l4; my_lineno += l4;
yylval->str = strdup(yytext); yylval->str = strdup(yytext);
return word; return word;
} }
yymore();} yymore();
}
<semic>[^;()\{\}\[\]]*\( {/*printf("SEMIC:%s\n",yytext);*/yylloc->first_line = my_lineno;yylloc->first_column=my_col; yymore(); pbcpush('(');} <semic>[^;()\{\}\[\]]*\( {/*printf("SEMIC:%s\n",yytext);*/yylloc->first_line = my_lineno;yylloc->first_column=my_col; yymore(); pbcpush('(');}
<semic>[^;()\{\}\[\]]*\) {/*printf("SEMIC:%s\n",yytext);*/yylloc->first_line = my_lineno;yylloc->first_column=my_col; <semic>[^;()\{\}\[\]]*\) {/*printf("SEMIC:%s\n",yytext);*/yylloc->first_line = my_lineno;yylloc->first_column=my_col;
if ( pbcpop(')') ) { if ( pbcpop(')') ) {
/* error */ /* error */
int l4,c4; int l4,c4;
pbcwhere(yytext, &l4, &c4); pbcwhere(yytext, &l4, &c4);
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ')' in expression!\n", my_file, my_lineno+l4, my_col+c4); ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ')' in expression!\n", my_file, my_lineno+l4, my_col+c4);
BEGIN(0); BEGIN(0);
yylloc->last_line = my_lineno+l4; yylloc->last_line = my_lineno+l4;
yylloc->last_column=my_col+c4; yylloc->last_column=my_col+c4;
my_col=c4; my_col=c4;
my_lineno += l4; my_lineno += l4;
yylval->str = strdup(yytext); yylval->str = strdup(yytext);
return word; return word;
} }
yymore();} yymore();
}
<semic>[^;()\{\}\[\]]*; { <semic>[^;()\{\}\[\]]*; {
int linecount = 0; int linecount = 0;
int colcount = my_col; int colcount = my_col;
char *pt = yytext; char *pt = yytext;
while (*pt) { while (*pt) {
if ( *pt == '\n' ) { if ( *pt == '\n' ) {
linecount++; linecount++;
colcount=0; colcount=0;
} }
pt++; pt++;
colcount++; colcount++;
} }
yylloc->first_line = my_lineno; yylloc->first_line = my_lineno;
yylloc->last_line = my_lineno+linecount; yylloc->last_line = my_lineno+linecount;
yylloc->last_column=colcount; yylloc->last_column=colcount;
yylloc->first_column=my_col; yylloc->first_column=my_col;
yylval->str = strdup(yytext); yylval->str = strdup(yytext);
if(yyleng > 1) if(yyleng > 1)
*(yylval->str+yyleng-1)=0; *(yylval->str+yyleng-1)=0;
/* printf("Got semic word %s\n", yylval->str); */ /* printf("Got semic word %s\n", yylval->str); */
unput(';'); unput(';');
BEGIN(0); BEGIN(0);
my_col=colcount; my_col=colcount;
my_lineno += linecount; my_lineno += linecount;
return word; return word;
} }
\#include[ \t]+\"[^\"]+\" { \#include[ \t]+\"[^\"]+\" {
FILE *in1; FILE *in1;
char fnamebuf[1024],*p1,*p2; char fnamebuf[1024],*p1,*p2;
if ( include_stack_index >= MAX_INCLUDE_DEPTH ) { if ( include_stack_index >= MAX_INCLUDE_DEPTH ) {
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Includes nested too deeply! Wow!!! How did you do that?\n", my_file, my_lineno, my_col); ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Includes nested too deeply! Wow!!! How did you do that?\n", my_file, my_lineno, my_col);
} else { } else {
p1 = strchr(yytext,'"'); p1 = strchr(yytext,'"');
p2 = strrchr(yytext,'"'); p2 = strrchr(yytext,'"');
if ( (int)(p2-p1) > 1023 ) { if ( (int)(p2-p1) > 1023 ) {
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Filename is incredibly way too long (%d chars!). Inclusion ignored!\n", my_file, my_lineno, my_col, yyleng - 10); ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Filename is incredibly way too long (%d chars!). Inclusion ignored!\n", my_file, my_lineno, my_col, yyleng - 10);
} else { } else {
int i; int i;
int found = 0; int found = 0;
strncpy(fnamebuf,p1,p2-p1); strncpy(fnamebuf,p1,p2-p1);
fnamebuf[p2-p1] = 0; fnamebuf[p2-p1] = 0;
for (i=0; i<include_stack_index; i++) { for (i=0; i<include_stack_index; i++) {
if ( !strcmp(fnamebuf,include_stack[i].fname )) { if ( !strcmp(fnamebuf,include_stack[i].fname )) {
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Nice Try!!! But %s has already been included (perhaps by another file), and would cause an infinite loop of file inclusions!!! Include directive ignored\n", ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Nice Try!!! But %s has already been included (perhaps by another file), and would cause an infinite loop of file inclusions!!! Include directive ignored\n",
my_file, my_lineno, my_col, fnamebuf); my_file, my_lineno, my_col, fnamebuf);
found=1; found=1;
break; break;
} }
} }
if( !found ) if ( !found ) {
{ *p2 = 0;
*p2 = 0; /* relative vs. absolute */
/* relative vs. absolute */ if ( *(p1+1) != '/' ) {
if ( *(p1+1) != '/' ) strcpy(fnamebuf,ast_config_AST_CONFIG_DIR);
{ strcat(fnamebuf,"/");
strcpy(fnamebuf,ast_config_AST_CONFIG_DIR); strcat(fnamebuf,p1+1);
strcat(fnamebuf,"/"); } else
strcat(fnamebuf,p1+1); strcpy(fnamebuf,p1+1);
} in1 = fopen( fnamebuf, "r" );
else if ( ! in1 ) {
strcpy(fnamebuf,p1+1);
in1 = fopen( fnamebuf, "r" );
if ( ! in1 ) {
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Couldn't find the include file: %s; ignoring the Include directive!\n", my_file, my_lineno, my_col, fnamebuf); ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Couldn't find the include file: %s; ignoring the Include directive!\n", my_file, my_lineno, my_col, fnamebuf);
} else { } else {
char *buffer; char *buffer;
struct stat stats; struct stat stats;
stat(fnamebuf, &stats); stat(fnamebuf, &stats);
buffer = (char*)malloc(stats.st_size+1); buffer = (char*)malloc(stats.st_size+1);
fread(buffer, 1, stats.st_size, in1); fread(buffer, 1, stats.st_size, in1);
buffer[stats.st_size] = 0; buffer[stats.st_size] = 0;
ast_log(LOG_NOTICE," --Read in included file %s, %d chars\n",fnamebuf, (int)stats.st_size); ast_log(LOG_NOTICE," --Read in included file %s, %d chars\n",fnamebuf, (int)stats.st_size);
fclose(in1); fclose(in1);
include_stack[include_stack_index].fname = my_file; include_stack[include_stack_index].fname = my_file;
my_file = strdup(fnamebuf); my_file = strdup(fnamebuf);
@@ -473,30 +504,29 @@ includes {yylloc->first_line = yylloc->last_line = my_lineno; yylloc->last_colum
include_stack[include_stack_index].colno = my_col+yyleng; include_stack[include_stack_index].colno = my_col+yyleng;
include_stack[include_stack_index++].bufstate = YY_CURRENT_BUFFER; include_stack[include_stack_index++].bufstate = YY_CURRENT_BUFFER;
yy_switch_to_buffer(ael_yy_scan_string (buffer ,yyscanner),yyscanner); yy_switch_to_buffer(ael_yy_scan_string (buffer ,yyscanner),yyscanner);
free(buffer); free(buffer);
my_lineno = 1; my_lineno = 1;
my_col = 1; my_col = 1;
BEGIN(INITIAL); BEGIN(INITIAL);
} }
} }
} }
} }
} }
<<EOF>> {
if ( --include_stack_index < 0 ) {
yyterminate();
} else {
free(my_file);
yy_delete_buffer( YY_CURRENT_BUFFER, yyscanner );
yy_switch_to_buffer(include_stack[include_stack_index].bufstate, yyscanner );
my_lineno = include_stack[include_stack_index].lineno;
my_col = include_stack[include_stack_index].colno;
my_file = include_stack[include_stack_index].fname;
}
}
<<EOF>> {
if ( --include_stack_index < 0 ) {
yyterminate();
} else {
free(my_file);
yy_delete_buffer( YY_CURRENT_BUFFER, yyscanner );
yy_switch_to_buffer(include_stack[include_stack_index].bufstate, yyscanner );
my_lineno = include_stack[include_stack_index].lineno;
my_col = include_stack[include_stack_index].colno;
my_file = include_stack[include_stack_index].fname;
}
}
%% %%
@@ -513,25 +543,24 @@ static int pbcpop(char x)
pbcpos--; pbcpos--;
return 0; return 0;
} }
else return 1; /* error */
return 1; /* error */
} }
static int c_prevword(void) static int c_prevword(void)
{ {
char *c = prev_word; char *c = prev_word;
int ret = 0; int ret = 0;
while ( c && *c ) { while ( c && *c ) {
switch (*c) { switch (*c) {
case '{': pbcpush('{');break; case '{': pbcpush('{');break;
case '}': ret = pbcpop('}');break; case '}': ret = pbcpop('}');break;
case '[':pbcpush('[');break; case '[':pbcpush('[');break;
case ']':ret = pbcpop(']');break; case ']':ret = pbcpop(']');break;
case '(':pbcpush('(');break; case '(':pbcpush('(');break;
case ')':ret = pbcpop(')'); break; case ')':ret = pbcpop(')'); break;
} }
if( ret ) if( ret )
return 1; return 1;
c++; c++;
} }
return 0; return 0;
@@ -540,18 +569,18 @@ static int c_prevword(void)
static void pbcwhere(char *text, int *line, int *col ) static void pbcwhere(char *text, int *line, int *col )
{ {
int loc_line = 0; int loc_line = 0;
int loc_col = 0; int loc_col = 0;
while ( *text ) { while ( *text ) {
if ( *text == '\n' ) { if ( *text == '\n' ) {
loc_line++; loc_line++;
loc_col = 1; loc_col = 1;
} else { } else {
loc_col++; loc_col++;
} }
text++; text++;
} }
*line = loc_line; *line = loc_line;
*col = loc_col; *col = loc_col;
} }
void reset_parencount(yyscan_t yyscanner ) void reset_parencount(yyscan_t yyscanner )

File diff suppressed because it is too large Load Diff