9 #include "zeth_config.h"
11 #include <boost/program_options.hpp>
16 namespace po = boost::program_options;
36 po::options_description
desc;
38 po::positional_options_description
pos;
51 void parse(
int argc,
char **argv);
59 , command(
"pot-process")
69 desc.add_options()(
"help,h",
"This help")(
"verbose,v",
"Verbose output")(
70 "check",
"Check pot well-formedness and exit")(
71 "out,o", po::value<std::string>(),
"Output file")(
72 "lagrange-degree", po::value<size_t>(),
"Use degree l")(
73 "dummy",
"Create dummy powersoftau data (!for testing only)");
75 "powersoftau_file", po::value<std::string>(),
"powersoftau file")(
76 "degree", po::value<size_t>(),
"degree");
77 pos.add(
"powersoftau_file", 1).add(
"degree", 1);
82 std::cout <<
"Usage:" << std::endl
84 <<
" [<options>] <powersoftau file> <degree>\n\n"
91 po::parsed_options parsed = po::command_line_parser(argc, argv)
95 po::store(parsed, vm);
99 if (vm.count(
"help")) {
104 if (0 == vm.count(
"powersoftau_file")) {
105 throw po::error(
"powersoftau_file not specified");
107 if (0 == vm.count(
"degree")) {
108 throw po::error(
"degree not specified");
113 check = vm.count(
"check");
114 degree = vm[
"degree"].as<
size_t>();
116 ? vm[
"lagrange-degree"].as<
size_t>()
118 out = vm.count(
"out") ? vm[
"out"].as<std::string>()
120 dummy = vm.count(
"dummy");
123 throw po::error(
"specify at most one of --dummy and --check");
131 static int powersoftau_main(
const cli_options &options)
140 std::cout <<
" command: " << options.
command <<
"\n";
141 std::cout <<
" help: " << std::to_string(options.
help) <<
"\n";
143 std::cout <<
" degree: " << std::to_string(options.
degree) <<
"\n";
144 std::cout <<
" verbose: " << std::to_string(options.
verbose) <<
"\n";
145 std::cout <<
" check: " << std::to_string(options.
check) << std::endl;
146 std::cout <<
" out: " << options.
out <<
"\n";
147 std::cout <<
" lagrange_degree: "
151 pp::init_public_params();
153 libff::inhibit_profiling_counters =
true;
154 libff::inhibit_profiling_info =
true;
161 std::cout <<
"Writing locally constructed powersoftau to "
165 std::ios_base::binary | std::ios_base::out);
168 std::cout <<
"DONE" << std::endl;
176 powersoftau_load<pp>(in, options.
degree);
182 std::cerr <<
"Invalid powersoftau file" << std::endl;
186 std::cout <<
"powersoftau file is valid" << std::endl;
194 std::cout <<
"Writing Lagrange polynomial values to " << options.
out
196 std::ofstream out(options.
out, std::ios_base::binary | std::ios_base::out);
200 std::cout <<
"DONE" << std::endl;
204 int main(
int argc,
char **argv)
210 options.
parse(argc, argv);
211 }
catch (po::error &error) {
212 std::cerr <<
" ERROR: " << error.what() << std::endl;
213 std::cout << std::endl;
220 return powersoftau_main(options);
221 }
catch (std::invalid_argument &error) {
222 std::cerr <<
" ERROR: " << error.what() << std::endl;
223 std::cout << std::endl;