Пример #1
0
def main(arg_list=None):
    args = vars(parse_args(arg_list))
    Logger.show_log_levels += args["verbose"] - args["quiet"]
    Logger.debug("Log level: {}".format(Logger.show_log_levels))
    Logger.debug("Arguments: {}".format(args))
    auto_functions = [
        Function(open(function_file).read(), get_script_dir())
        for function_file in args["input_files"]
    ]
    Logger.info("Found auto functions: {}".format(
        [func.get_name() for func in auto_functions]))
    cpp_file = open(args["output_cpp"], "w")
    h_file = open(args["output_header"], "w")

    compiled_auto_functions = generate_auto_functions(auto_functions,
                                                      args["output_header"])

    if args["format"]:
        Logger.info("Formatting output files")
        compiled_auto_functions = [
            Formatter(func).get_formatted_text()
            for func in compiled_auto_functions
        ]

    Logger.debug("Writing output files")
    h_file.write(compiled_auto_functions[0])
    cpp_file.write(compiled_auto_functions[1])
    cpp_file.close()
    h_file.close()
    Logger.info("Done :)")
def main(arg_list=None):
    args = vars(parse_args(arg_list))
    Logger.show_log_levels += args["verbose"] - args["quiet"]
    Logger.debug("Log level: {}".format(Logger.show_log_levels))
    Logger.debug("Arguments: {}".format(args))
    auto_functions = enumerate_auto_files(args["input_dir"])
    Logger.info("Found auto functions: {}".format([func.get_name() for func in auto_functions]))
    output_path = args["output_dir"]
    if output_path[-1] != "/":
        output_path += "/"

    cpp_file = open(output_path + "auto_functions.cpp", "w")
    h_file = open(output_path + "auto_functions.h", "w")

    compiled_auto_functions = generate_auto_functions(auto_functions)

    if args["format"]:
        Logger.info("Formatting output files")
        compiled_auto_functions = [Formatter(func).get_formatted_text() for func in compiled_auto_functions]

    Logger.debug("Writing output files")
    h_file.write(compiled_auto_functions[0])
    cpp_file.write(compiled_auto_functions[1])
    cpp_file.close()
    h_file.close()
    Logger.info("Done :)")
Пример #3
0
def main(arg_list=None):
    args = vars(parse_args(arg_list))
    Logger.show_log_levels += args["verbose"] - args["quiet"]
    Logger.debug("Log level: {}".format(Logger.show_log_levels))
    Logger.debug("Arguments: {}".format(args))
    auto_functions = [Function(open(function_file).read(), get_script_dir()) for function_file in args["input_files"]]
    Logger.info("Found auto functions: {}".format([func.get_name() for func in auto_functions]))
    cpp_file = open(args["output_cpp"], "w")
    h_file = open(args["output_header"], "w")

    compiled_auto_functions = generate_auto_functions(auto_functions, args["output_header"])

    if args["format"]:
        Logger.info("Formatting output files")
        compiled_auto_functions = [Formatter(func).get_formatted_text() for func in compiled_auto_functions]

    Logger.debug("Writing output files")
    h_file.write(compiled_auto_functions[0])
    cpp_file.write(compiled_auto_functions[1])
    cpp_file.close()
    h_file.close()
    Logger.info("Done :)")
#!/usr/bin/python
import os
import sys

parent_dir = os.path.dirname(os.path.realpath(__file__)) + "/../../../"
sys.path.append(parent_dir)
from objects.logger import Logger

if len(sys.argv) > 3:
    Logger.show_log_levels = int(sys.argv[3])

if sys.argv[1] == "error":
    Logger.error(sys.argv[2])
    sys.exit(0)
if sys.argv[1] == "warn":
    Logger.warn(sys.argv[2])
    sys.exit(0)
if sys.argv[1] == "info":
    Logger.info(sys.argv[2])
    sys.exit(0)
if sys.argv[1] == "debug":
    Logger.debug(sys.argv[2])
    sys.exit(0)