1*fb0bc835SMarkus Armbruster#!/usr/bin/env python 2*fb0bc835SMarkus Armbruster# QAPI generator 3*fb0bc835SMarkus Armbruster# 4*fb0bc835SMarkus Armbruster# This work is licensed under the terms of the GNU GPL, version 2 or later. 5*fb0bc835SMarkus Armbruster# See the COPYING file in the top-level directory. 6*fb0bc835SMarkus Armbruster 7*fb0bc835SMarkus Armbrusterimport sys 8*fb0bc835SMarkus Armbrusterfrom qapi.common import parse_command_line, QAPISchema 9*fb0bc835SMarkus Armbrusterfrom qapi.types import gen_types 10*fb0bc835SMarkus Armbrusterfrom qapi.visit import gen_visit 11*fb0bc835SMarkus Armbrusterfrom qapi.commands import gen_commands 12*fb0bc835SMarkus Armbrusterfrom qapi.events import gen_events 13*fb0bc835SMarkus Armbrusterfrom qapi.introspect import gen_introspect 14*fb0bc835SMarkus Armbrusterfrom qapi.doc import gen_doc 15*fb0bc835SMarkus Armbruster 16*fb0bc835SMarkus Armbruster 17*fb0bc835SMarkus Armbrusterdef main(argv): 18*fb0bc835SMarkus Armbruster (input_file, output_dir, prefix, opts) = \ 19*fb0bc835SMarkus Armbruster parse_command_line('bu', ['builtins', 'unmask-non-abi-names']) 20*fb0bc835SMarkus Armbruster 21*fb0bc835SMarkus Armbruster opt_builtins = False 22*fb0bc835SMarkus Armbruster opt_unmask = False 23*fb0bc835SMarkus Armbruster 24*fb0bc835SMarkus Armbruster for o, a in opts: 25*fb0bc835SMarkus Armbruster if o in ('-b', '--builtins'): 26*fb0bc835SMarkus Armbruster opt_builtins = True 27*fb0bc835SMarkus Armbruster if o in ('-u', '--unmask-non-abi-names'): 28*fb0bc835SMarkus Armbruster opt_unmask = True 29*fb0bc835SMarkus Armbruster 30*fb0bc835SMarkus Armbruster schema = QAPISchema(input_file) 31*fb0bc835SMarkus Armbruster 32*fb0bc835SMarkus Armbruster gen_types(schema, output_dir, prefix, opt_builtins) 33*fb0bc835SMarkus Armbruster gen_visit(schema, output_dir, prefix, opt_builtins) 34*fb0bc835SMarkus Armbruster gen_commands(schema, output_dir, prefix) 35*fb0bc835SMarkus Armbruster gen_events(schema, output_dir, prefix) 36*fb0bc835SMarkus Armbruster gen_introspect(schema, output_dir, prefix, opt_unmask) 37*fb0bc835SMarkus Armbruster gen_doc(schema, output_dir, prefix) 38*fb0bc835SMarkus Armbruster 39*fb0bc835SMarkus Armbruster 40*fb0bc835SMarkus Armbrusterif __name__ == '__main__': 41*fb0bc835SMarkus Armbruster main(sys.argv) 42