Commit aacae1a9 authored by Maxime Perrotin's avatar Maxime Perrotin

Add new Python generator

parent 0687f5a8
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This application generates the Ada code needed to iterate on ASN.1 values
It is part of the TASTE project
Copyright (c) 2019 Maxime Perrotin
(c) 2019 European Space Agency
Contact : maxime.perrotin@esa.int
"""
__version__ = "3.0.0"
import argparse
import logging
from opengeode import Asn1scc
def init_logging(options):
''' Initialize logging '''
terminal_formatter = logging.Formatter(fmt="[%(levelname)s] %(message)s")
handler_console = logging.StreamHandler()
handler_console.setFormatter(terminal_formatter)
LOG.addHandler(handler_console)
level = logging.DEBUG if options.debug else logging.INFO
LOG.setLevel(level)
def parse_args():
''' Parse command line arguments '''
parser = argparse.ArgumentParser()
parser.add_argument(
'-v',
'--version',
action='version',
version=__version__)
parser.add_argument(
'-g',
'--debug',
action='store_true',
default=False,
help='Display debug information')
parser.add_argument(
'files',
metavar='dataview-uniq.asn',
type=str,
nargs='*',
help='ASN.1 file(s)')
return parser.parse_args()
def main():
''' Tool entry point '''
# Catch Ctrl-C to stop the app from the console
signal.signal(signal.SIGINT, signal.SIG_DFL)
options = parse_args()
init_logging(options)
LOG.info('Ada Iterators for ASN.1 - version ' + __version__)
if __name__ == '__main__':
''' Run main application '''
main()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment