~drizzle-trunk/drizzle/development

641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
1
#!/bin/bash
2
#
641.2.2 by Monty Taylor
InnoDB Plugin 1.0.3
3
# Copyright (c) 2006, 2009, Innobase Oy. All Rights Reserved.
4
# 
5
# This program is free software; you can redistribute it and/or modify it under
6
# the terms of the GNU General Public License as published by the Free Software
7
# Foundation; version 2 of the License.
8
# 
9
# This program is distributed in the hope that it will be useful, but WITHOUT
10
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
# 
13
# You should have received a copy of the GNU General Public License along with
14
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15
# Place, Suite 330, Boston, MA 02111-1307 USA
16
#
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
17
# generate lexer files from flex input files.
18
19
set -eu
20
21
TMPFILE=_flex_tmp.c
22
OUTFILE=lexyy.c
23
24
flex -o $TMPFILE pars0lex.l
25
26
# AIX needs its includes done in a certain order, so include "univ.i" first
27
# to be sure we get it right.
28
echo '#include "univ.i"' > $OUTFILE
29
30
# flex assigns a pointer to an int in one place without a cast, resulting in
31
# a warning on Win64.  Add the cast.  Also define some symbols as static.
32
sed -e '
33
s/'"$TMPFILE"'/'"$OUTFILE"'/;
34
s/\(int offset = \)\((yy_c_buf_p) - (yytext_ptr)\);/\1(int)(\2);/;
35
s/\(void yy\(restart\|_\(delete\|flush\)_buffer\)\)/static \1/;
36
s/\(void yy_switch_to_buffer\)/__attribute__((unused)) static \1/;
37
s/\(void yy\(push\|pop\)_buffer_state\)/__attribute__((unused)) static \1/;
38
s/\(YY_BUFFER_STATE yy_create_buffer\)/static \1/;
39
s/\(\(int\|void\) yy[gs]et_\)/__attribute__((unused)) static \1/;
40
s/\(void \*\?yy\(\(re\)\?alloc\|free\)\)/static \1/;
41
s/\(extern \)\?\(int yy\(leng\|lineno\|_flex_debug\)\)/static \2/;
42
s/\(int yylex_destroy\)/__attribute__((unused)) static \1/;
43
s/\(extern \)\?\(int yylex \)/UNIV_INTERN \2/;
44
s/^\(\(FILE\|char\) *\* *yyget\)/__attribute__((unused)) static \1/;
45
s/^\(extern \)\?\(\(FILE\|char\) *\* *yy\)/static \2/;
46
' < $TMPFILE >> $OUTFILE
47
48
rm $TMPFILE