#!/usr/bin/env python
#-----------------------------------------------------------------------------
#
#  TSDuck - The MPEG Transport Stream Toolkit
#  Copyright (c) 2005-2022, Thierry Lelegard
#  All rights reserved.
#
#  Redistribution and use in source and binary forms, with or without
#  modification, are permitted provided that the following conditions are met:
#
#  1. Redistributions of source code must retain the above copyright notice,
#     this list of conditions and the following disclaimer.
#  2. Redistributions in binary form must reproduce the above copyright
#     notice, this list of conditions and the following disclaimer in the
#     documentation and/or other materials provided with the distribution.
#
#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
#  THE POSSIBILITY OF SUCH DAMAGE.
#
#-----------------------------------------------------------------------------
# 
#  Build the file tsduck.dektec.names, containing Dektec-specific names.
#  Syntax: build-dektec-names.py in-file out-file
# 
#-----------------------------------------------------------------------------

import tsbuild, sys, os, re

if len(sys.argv) != 3:
    print('Usage: %s in-file out-file' % sys.argv[0], file=sys.stderr)
    exit(1)

input_file = sys.argv[1]
output_file = sys.argv[2]
    
with open(output_file, 'w') as output:
    tsbuild.write_source_header('#', 'Registered names for Dektec devices', file=output)
    print('[DtCaps]', file=output)
    if input_file != '':
        with open(input_file, 'r', encoding='utf-8') as input:
            for line in input:
                match = re.search(r'#define\s+DTAPI_CAP_.*\sDtapi::DtCaps\(([\d]+)\)\s*//\s*(.+)$', line.strip())
                if match is not None:
                    print('%s = %s' % (match.group(1), match.group(2)), file=output)

8410dd0ee1414b5ea7b01b565cddf2928143c294
<mask token>

<mask token>
if len(sys.argv) != 3:
    print('Usage: %s in-file out-file' % sys.argv[0], file=sys.stderr)
    exit(1)
<mask token>
with open(output_file, 'w') as output:
    tsbuild.write_source_header('#', 'Registered names for Dektec devices',
        file=output)
    print('[DtCaps]', file=output)
    if input_file != '':
        with open(input_file, 'r', encoding='utf-8') as input:
            for line in input:
                match = re.search(
                    '#define\\s+DTAPI_CAP_.*\\sDtapi::DtCaps\\(([\\d]+)\\)\\s*//\\s*(.+)$'
                    , line.strip())
                if match is not None:
                    print('%s = %s' % (match.group(1), match.group(2)),
                        file=output)

<mask token>
if len(sys.argv) != 3:
    print('Usage: %s in-file out-file' % sys.argv[0], file=sys.stderr)
    exit(1)
input_file = sys.argv[1]
output_file = sys.argv[2]
with open(output_file, 'w') as output:
    tsbuild.write_source_header('#', 'Registered names for Dektec devices',
        file=output)
    print('[DtCaps]', file=output)
    if input_file != '':
        with open(input_file, 'r', encoding='utf-8') as input:
            for line in input:
                match = re.search(
                    '#define\\s+DTAPI_CAP_.*\\sDtapi::DtCaps\\(([\\d]+)\\)\\s*//\\s*(.+)$'
                    , line.strip())
                if match is not None:
                    print('%s = %s' % (match.group(1), match.group(2)),
                        file=output)

import tsbuild, sys, os, re
if len(sys.argv) != 3:
    print('Usage: %s in-file out-file' % sys.argv[0], file=sys.stderr)
    exit(1)
input_file = sys.argv[1]
output_file = sys.argv[2]
with open(output_file, 'w') as output:
    tsbuild.write_source_header('#', 'Registered names for Dektec devices',
        file=output)
    print('[DtCaps]', file=output)
    if input_file != '':
        with open(input_file, 'r', encoding='utf-8') as input:
            for line in input:
                match = re.search(
                    '#define\\s+DTAPI_CAP_.*\\sDtapi::DtCaps\\(([\\d]+)\\)\\s*//\\s*(.+)$'
                    , line.strip())
                if match is not None:
                    print('%s = %s' % (match.group(1), match.group(2)),
                        file=output)

#!/usr/bin/env python
#-----------------------------------------------------------------------------
#
#  TSDuck - The MPEG Transport Stream Toolkit
#  Copyright (c) 2005-2022, Thierry Lelegard
#  All rights reserved.
#
#  Redistribution and use in source and binary forms, with or without
#  modification, are permitted provided that the following conditions are met:
#
#  1. Redistributions of source code must retain the above copyright notice,
#     this list of conditions and the following disclaimer.
#  2. Redistributions in binary form must reproduce the above copyright
#     notice, this list of conditions and the following disclaimer in the
#     documentation and/or other materials provided with the distribution.
#
#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
#  THE POSSIBILITY OF SUCH DAMAGE.
#
#-----------------------------------------------------------------------------
# 
#  Build the file tsduck.dektec.names, containing Dektec-specific names.
#  Syntax: build-dektec-names.py in-file out-file
# 
#-----------------------------------------------------------------------------

import tsbuild, sys, os, re

if len(sys.argv) != 3:
    print('Usage: %s in-file out-file' % sys.argv[0], file=sys.stderr)
    exit(1)

input_file = sys.argv[1]
output_file = sys.argv[2]
    
with open(output_file, 'w') as output:
    tsbuild.write_source_header('#', 'Registered names for Dektec devices', file=output)
    print('[DtCaps]', file=output)
    if input_file != '':
        with open(input_file, 'r', encoding='utf-8') as input:
            for line in input:
                match = re.search(r'#define\s+DTAPI_CAP_.*\sDtapi::DtCaps\(([\d]+)\)\s*//\s*(.+)$', line.strip())
                if match is not None:
                    print('%s = %s' % (match.group(1), match.group(2)), file=output)
