2014-09-07 23:56:09 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
#
|
2020-02-11 23:04:29 +00:00
|
|
|
# Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
|
|
|
|
#
|
|
|
|
# GNSS-SDR is a software-defined Global Navigation Satellite Systems receiver
|
2014-09-07 23:56:09 +00:00
|
|
|
#
|
2014-11-07 17:02:52 +00:00
|
|
|
# This file is part of GNSS-SDR.
|
2014-09-07 23:56:09 +00:00
|
|
|
#
|
2020-02-08 00:20:02 +00:00
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
2014-09-07 23:56:09 +00:00
|
|
|
#
|
|
|
|
|
2016-12-25 14:44:45 +00:00
|
|
|
from __future__ import print_function
|
|
|
|
|
2014-09-07 23:56:09 +00:00
|
|
|
import os
|
|
|
|
import re
|
|
|
|
import sys
|
|
|
|
import optparse
|
|
|
|
import volk_gnsssdr_arch_defs
|
|
|
|
import volk_gnsssdr_machine_defs
|
|
|
|
import volk_gnsssdr_kernel_defs
|
2016-07-15 02:34:49 +00:00
|
|
|
from mako.template import Template
|
2014-09-07 23:56:09 +00:00
|
|
|
|
|
|
|
def __parse_tmpl(_tmpl, **kwargs):
|
|
|
|
defs = {
|
|
|
|
'archs': volk_gnsssdr_arch_defs.archs,
|
|
|
|
'arch_dict': volk_gnsssdr_arch_defs.arch_dict,
|
|
|
|
'machines': volk_gnsssdr_machine_defs.machines,
|
|
|
|
'machine_dict': volk_gnsssdr_machine_defs.machine_dict,
|
|
|
|
'kernels': volk_gnsssdr_kernel_defs.kernels,
|
|
|
|
}
|
|
|
|
defs.update(kwargs)
|
|
|
|
_tmpl = """
|
2016-01-12 19:15:16 +00:00
|
|
|
|
2016-07-15 02:34:49 +00:00
|
|
|
/* this file was generated by volk_gnsssdr template utils, do not edit! */
|
2016-01-12 19:15:16 +00:00
|
|
|
|
2016-07-15 02:34:49 +00:00
|
|
|
""" + _tmpl
|
|
|
|
return str(Template(_tmpl).render(**defs))
|
2014-09-07 23:56:09 +00:00
|
|
|
|
|
|
|
def main():
|
|
|
|
parser = optparse.OptionParser()
|
|
|
|
parser.add_option('--input', type='string')
|
|
|
|
parser.add_option('--output', type='string')
|
|
|
|
(opts, args) = parser.parse_args()
|
2016-01-12 19:15:16 +00:00
|
|
|
|
2014-09-07 23:56:09 +00:00
|
|
|
output = __parse_tmpl(open(opts.input).read(), args=args)
|
|
|
|
if opts.output: open(opts.output, 'w').write(output)
|
2016-12-25 14:44:45 +00:00
|
|
|
else: print(output)
|
2014-09-07 23:56:09 +00:00
|
|
|
|
|
|
|
if __name__ == '__main__': main()
|
2016-01-12 19:15:16 +00:00
|
|
|
|