~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/innobase/pars/make_flex.sh

Tags: innodb-plugin-1.0.1
Imported 1.0.1 with clean - with no changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
#
 
3
# generate lexer files from flex input files.
 
4
 
 
5
set -eu
 
6
 
 
7
TMPFILE=_flex_tmp.c
 
8
OUTFILE=lexyy.c
 
9
 
 
10
flex -o $TMPFILE pars0lex.l
 
11
 
 
12
# AIX needs its includes done in a certain order, so include "univ.i" first
 
13
# to be sure we get it right.
 
14
echo '#include "univ.i"' > $OUTFILE
 
15
 
 
16
# flex assigns a pointer to an int in one place without a cast, resulting in
 
17
# a warning on Win64.  Add the cast.  Also define some symbols as static.
 
18
sed -e '
 
19
s/'"$TMPFILE"'/'"$OUTFILE"'/;
 
20
s/\(int offset = \)\((yy_c_buf_p) - (yytext_ptr)\);/\1(int)(\2);/;
 
21
s/\(void yy\(restart\|_\(delete\|flush\)_buffer\)\)/static \1/;
 
22
s/\(void yy_switch_to_buffer\)/__attribute__((unused)) static \1/;
 
23
s/\(void yy\(push\|pop\)_buffer_state\)/__attribute__((unused)) static \1/;
 
24
s/\(YY_BUFFER_STATE yy_create_buffer\)/static \1/;
 
25
s/\(\(int\|void\) yy[gs]et_\)/__attribute__((unused)) static \1/;
 
26
s/\(void \*\?yy\(\(re\)\?alloc\|free\)\)/static \1/;
 
27
s/\(extern \)\?\(int yy\(leng\|lineno\|_flex_debug\)\)/static \2/;
 
28
s/\(int yylex_destroy\)/__attribute__((unused)) static \1/;
 
29
s/\(extern \)\?\(int yylex \)/UNIV_INTERN \2/;
 
30
s/^\(\(FILE\|char\) *\* *yyget\)/__attribute__((unused)) static \1/;
 
31
s/^\(extern \)\?\(\(FILE\|char\) *\* *yy\)/static \2/;
 
32
' < $TMPFILE >> $OUTFILE
 
33
 
 
34
rm $TMPFILE