xref: /openbmc/linux/tools/verification/dot2/dot2c (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
1e3c9fc78SDaniel Bristot de Oliveira#!/usr/bin/env python3
2e3c9fc78SDaniel Bristot de Oliveira# SPDX-License-Identifier: GPL-2.0-only
3e3c9fc78SDaniel Bristot de Oliveira#
4e3c9fc78SDaniel Bristot de Oliveira# Copyright (C) 2019-2022 Red Hat, Inc. Daniel Bristot de Oliveira <bristot@kernel.org>
5e3c9fc78SDaniel Bristot de Oliveira#
6e3c9fc78SDaniel Bristot de Oliveira# dot2c: parse an automata in dot file digraph format into a C
7e3c9fc78SDaniel Bristot de Oliveira#
8e3c9fc78SDaniel Bristot de Oliveira# This program was written in the development of this paper:
9e3c9fc78SDaniel Bristot de Oliveira#  de Oliveira, D. B. and Cucinotta, T. and de Oliveira, R. S.
10e3c9fc78SDaniel Bristot de Oliveira#  "Efficient Formal Verification for the Linux Kernel." International
11e3c9fc78SDaniel Bristot de Oliveira#  Conference on Software Engineering and Formal Methods. Springer, Cham, 2019.
12*4041b9bbSDaniel Bristot de Oliveira#
13*4041b9bbSDaniel Bristot de Oliveira# For further information, see:
14*4041b9bbSDaniel Bristot de Oliveira#   Documentation/trace/rv/deterministic_automata.rst
15e3c9fc78SDaniel Bristot de Oliveira
16e3c9fc78SDaniel Bristot de Oliveiraif __name__ == '__main__':
17e3c9fc78SDaniel Bristot de Oliveira    from dot2 import dot2c
18e3c9fc78SDaniel Bristot de Oliveira    import argparse
19e3c9fc78SDaniel Bristot de Oliveira    import sys
20e3c9fc78SDaniel Bristot de Oliveira
21e3c9fc78SDaniel Bristot de Oliveira    parser = argparse.ArgumentParser(description='dot2c: converts a .dot file into a C structure')
22e3c9fc78SDaniel Bristot de Oliveira    parser.add_argument('dot_file',  help='The dot file to be converted')
23e3c9fc78SDaniel Bristot de Oliveira
24e3c9fc78SDaniel Bristot de Oliveira    args = parser.parse_args()
25e3c9fc78SDaniel Bristot de Oliveira    d = dot2c.Dot2c(args.dot_file)
26e3c9fc78SDaniel Bristot de Oliveira    d.print_model_classic()
27