| 1 |
#!/usr/bin/env python3 |
| 2 |
|
| 3 |
import subprocess, sys, shlex |
| 4 |
|
| 5 |
cfile = sys.argv[1] |
| 6 |
hfile = sys.argv[2] |
| 7 |
lfile = sys.argv[3] |
| 8 |
tabhfile = sys.argv[4] |
| 9 |
|
| 10 |
args = ['--header-file=' + hfile, '-o', cfile, '-Ppriv_gst_parse_yy', lfile] |
| 11 |
flex = [r'@FLEX@'] + shlex.split(r'@FLEX_ARGS@') |
| 12 |
subprocess.check_call(flex + args) |
| 13 |
|
| 14 |
prefix = '''#ifdef HAVE_CONFIG_H |
| 15 |
#include<config.h> |
| 16 |
#endif |
| 17 |
''' |
| 18 |
parse_snippet = '''void priv_gst_parse_yyset_column (int column_no , void * yyscanner); |
| 19 |
void priv_gst_parse_yyset_column (int column_no , void * yyscanner) |
| 20 |
''' |
| 21 |
|
| 22 |
contents = open(cfile).read() |
| 23 |
if not 'priv_gst_parse_yyget_column' in contents: |
| 24 |
contents = parse_snippet + contents |
| 25 |
contents = prefix + contents |
| 26 |
|
| 27 |
open(cfile, 'w').write(contents) |