# Always search current directory for include_file
    include_dirs = ["."]
    for o, a in opts:
        if o == "-I":
            include_dirs.append(a)
        elif o == "-i":
            id_spec = a.split(":")
            if len(id_spec) != 3:
                print("ERROR: -i needs a 'prefix:id_file:start_id' argument.")
                usage()

            [prefix, file_name, start_id] = id_spec
            vspec.db_mgr.create_signal_db(prefix, file_name, int(start_id))
        else:
            usage()

    if len(args) != 2:
        usage()

    json_out = open (args[1], "w")

    try:
        tree = vspec.load(args[0], include_dirs)
    except vspec.VSpecError as e:
        print("Error: {}".format(e))
        exit(255)

    json.dump(tree, json_out, indent=2)
    json_out.write("\n")
    json_out.close()
Exemplo n.º 2
0
    # Always search current directory for include_file
    vss_version = "unspecified version"
    include_dirs = ["."]
    for o, a in opts:
        if o == "-I":
            include_dirs.append(a)
        elif o == "-v":
            vss_version = a
        elif o == "-i":
            id_spec = a.split(":")
            if len(id_spec) != 2:
                print ("ERROR: -i needs a 'prefix:id_file' argument.")
                usage()

            [prefix, file_name] = id_spec
            vspec.db_mgr.create_signal_uuid_db(prefix, file_name)
        else:
            usage()

    if len(args) != 2:
        usage()

    try:
        tree = vspec.load(args[0], include_dirs)
    except vspec.VSpecError as e:
        print(("Error: {}".format(e)))
        exit(255)

    traverse_tree(tree)

Exemplo n.º 3
0
    parser.add_argument('-v', '--vssversion', type=str, default="unspecified version",  help='VSS version' )
    parser.add_argument('vspec_file', metavar='<vspec_file>', help='The vehicle specification file to convert.')
    parser.add_argument('franca_file', metavar='<franca file>', help='The file to output the Franca IDL spec to.')

    args = parser.parse_args()

    strict=args.strict
    
    include_dirs = ["."]
    include_dirs.extend(args.include_dir)

    franca_out = open(args.franca_file, "w")

    
    try:
        tree = vspec.load(args.vspec_file, include_dirs)
    except vspec.VSpecError as e:
        print("Error: {}".format(e))
        sys.exit(255)

    franca_out.write(
"""// Copyright (C) 2016, GENIVI Alliance
//
// This program is licensed under the terms and conditions of the
// Mozilla Public License, version 2.0.  The full text of the
// Mozilla Public License is at https://www.mozilla.org/MPL/2.0/

const UTF8String VSS_VERSION = "{}"

struct SignalSpec {{
    UInt32 id