42 "circle-operator allows users to retrieve operator information from a Circle model file"};
43 arser.add_argument(
"--name").nargs(0).help(
"Dump operators name in circle file");
44 arser.add_argument(
"--code").nargs(0).help(
"Dump operators code in circle file");
45 arser.add_argument(
"--output_path").help(
"Save output to file (default output is console)");
46 arser.add_argument(
"circle").help(
"Circle file to dump");
50 arser.parse(argc, argv);
52 catch (
const std::runtime_error &err)
54 std::cerr << err.what() << std::endl;
63 std::ofstream oFstream;
64 std::ostream *oStream = &std::cout;
65 if (
arser[
"--output_path"])
67 auto output_path =
arser.get<std::string>(
"--output_path");
68 oFstream.open(output_path, std::ofstream::out | std::ofstream::trunc);
71 std::cerr <<
"ERROR: Failed to create output to file " << output_path << std::endl;
79 memset(&sa, 0,
sizeof(
struct sigaction));
80 sigemptyset(&sa.sa_mask);
82 sa.sa_flags = SA_SIGINFO;
83 sigaction(SIGSEGV, &sa, NULL);
85 std::string modelFile =
arser.get<std::string>(
"circle");
90 std::vector<char> modelData = fileLoader.
load();
91 const circle::Model *circleModel = circle::GetModel(modelData.data());
92 if (circleModel ==
nullptr)
94 std::cerr <<
"ERROR: Failed to load circle '" << modelFile <<
"'" << std::endl;
98 dump.
run(*oStream, circleModel, option);
100 catch (
const std::runtime_error &err)
102 std::cerr <<
"ERROR: " << err.what() << std::endl;
106 if (oFstream.is_open())