Blame gst/parse/gen_lex.py.in
|
Packit |
a6ee4b |
#!/usr/bin/env python3
|
|
Packit |
a6ee4b |
|
|
Packit |
a6ee4b |
import subprocess, sys, shlex
|
|
Packit |
a6ee4b |
|
|
Packit |
a6ee4b |
cfile = sys.argv[1]
|
|
Packit |
a6ee4b |
hfile = sys.argv[2]
|
|
Packit |
a6ee4b |
lfile = sys.argv[3]
|
|
Packit |
a6ee4b |
tabhfile = sys.argv[4]
|
|
Packit |
a6ee4b |
|
|
Packit |
a6ee4b |
args = ['--header-file=' + hfile, '-o', cfile, '-Ppriv_gst_parse_yy', lfile]
|
|
Packit |
a6ee4b |
flex = [r'@FLEX@'] + shlex.split(r'@FLEX_ARGS@')
|
|
Packit |
a6ee4b |
subprocess.check_call(flex + args)
|
|
Packit |
a6ee4b |
|
|
Packit |
a6ee4b |
prefix = '''#ifdef HAVE_CONFIG_H
|
|
Packit |
a6ee4b |
#include<config.h>
|
|
Packit |
a6ee4b |
#endif
|
|
Packit |
a6ee4b |
'''
|
|
Packit |
a6ee4b |
parse_snippet = '''void priv_gst_parse_yyset_column (int column_no , void * yyscanner);
|
|
Packit |
a6ee4b |
void priv_gst_parse_yyset_column (int column_no , void * yyscanner)
|
|
Packit |
a6ee4b |
'''
|
|
Packit |
a6ee4b |
|
|
Packit |
a6ee4b |
contents = open(cfile).read()
|
|
Packit |
a6ee4b |
if not 'priv_gst_parse_yyget_column' in contents:
|
|
Packit |
a6ee4b |
contents = parse_snippet + contents
|
|
Packit |
a6ee4b |
contents = prefix + contents
|
|
Packit |
a6ee4b |
|
|
Packit |
a6ee4b |
open(cfile, 'w').write(contents)
|