32 #include <wx/cmdline.h> 39 #include <wx/cmdline.h> 54 bool parse( std::istream& aStream,
bool aVerbose )
71 board = parser.
Parse();
81 std::cout <<
"Took: " << duration.count() <<
"us" << std::endl;
84 return board !=
nullptr;
89 { wxCMD_LINE_SWITCH,
"h",
"help",
_(
"displays help on the command line parameters" ).mb_str(),
90 wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP },
91 { wxCMD_LINE_SWITCH,
"v",
"verbose",
_(
"print parsing information" ).mb_str() },
92 { wxCMD_LINE_PARAM,
nullptr,
nullptr,
_(
"input file" ).mb_str(), wxCMD_LINE_VAL_STRING,
93 wxCMD_LINE_PARAM_OPTIONAL | wxCMD_LINE_PARAM_MULTIPLE },
106 #ifdef __AFL_COMPILER 110 wxMessageOutput::Set(
new wxMessageOutputStderr );
111 wxCmdLineParser cl_parser( argc, argv );
113 cl_parser.AddUsageText(
114 _(
"This program parses PCB files, either from the " 115 "stdin stream or from the given filenames. This can be used either for " 116 "standalone testing of the parser or for fuzz testing." ) );
118 int cmd_parsed_ok = cl_parser.Parse();
119 if( cmd_parsed_ok != 0 )
125 const bool verbose = cl_parser.Found(
"verbose" );
129 const auto file_count = cl_parser.GetParamCount();
131 if( file_count == 0 )
137 ok =
parse( std::cin, verbose );
145 for(
unsigned i = 0; i < file_count; i++ )
147 const auto filename = cl_parser.GetParam( i ).ToStdString();
150 std::cout <<
"Parsing: " << filename << std::endl;
153 fin.open( filename );
155 ok = ok &&
parse( fin, verbose );
Tools can define their own statuses from here onwards.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Read a Pcbnew s-expression formatted LINE_READER object and returns the appropriate BOARD_ITEM object...
The command line was not correct for the tool.
void SetStream(std::istream &aStream)
Set the stream for this line reader.
static bool Register(const KI_TEST::UTILITY_PROGRAM &aProgInfo)
Register a utility program factory function against an ID string.
LINE_READER that wraps a given std::istream instance.
A small class to help profiling.
LINE_READER * SetLineReader(LINE_READER *aReader)
Set aLineReader into the parser, and returns the previous one, if any.
DURATION SinceStart(bool aSinceLast=false)
Pcbnew s-expression file format parser definition.
Hold an error message and may be used when throwing exceptions containing meaningful error messages.