KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pns_debug_tool_main.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20
21#include <wx/cmdline.h>
22
24#include <advanced_config.h>
25
26#include "pns_log_file.h"
28
29
30static const wxCmdLineEntryDesc g_cmdLineDesc[] = {
31 {
32 wxCMD_LINE_SWITCH,
33 "h",
34 "help",
35 _( "displays help on the command line parameters" ).mb_str(),
36 wxCMD_LINE_VAL_NONE,
37 wxCMD_LINE_OPTION_HELP,
38 },
39 {
40 wxCMD_LINE_OPTION,
41 "i",
42 "iteration-limit",
43 _( "Max number of iterations" ).mb_str(),
44 wxCMD_LINE_VAL_NUMBER,
45 wxCMD_LINE_PARAM_OPTIONAL,
46 },
47 {
48 wxCMD_LINE_OPTION,
49 "s",
50 "steps-limit",
51 _( "execute log up to steps-limit events" ).mb_str(),
52 wxCMD_LINE_VAL_NUMBER,
53 wxCMD_LINE_PARAM_OPTIONAL,
54 },
55 {
56 wxCMD_LINE_PARAM,
57 "filename",
58 "filename",
59 _( "log file name (no extensions)" ).mb_str(),
60 wxCMD_LINE_VAL_STRING,
61 wxCMD_LINE_PARAM_OPTIONAL,
62 },
63 { wxCMD_LINE_NONE }
64};
65
66int replay_main_func( int argc, char* argv[] )
67{
68 wxCmdLineParser cl_parser( argc, argv );
69 cl_parser.SetDesc( g_cmdLineDesc );
70 cl_parser.AddUsageText(
71 _( "PNS Log (Re)player. Allows to step through the log written by the ROUTER_TOOL "
72 "in debug KiCad builds." ) );
73
74 int cmd_parsed_ok = cl_parser.Parse();
75
76 if( cl_parser.Found("help") )
77 {
78 return 0;
79 }
80
81 if( cmd_parsed_ok != 0 )
82 {
83 printf("P&S Log Replay/Debug tool. For command line options, call %s -h.\n\n", argv[0] );
84 return ( cmd_parsed_ok == -1 ) ? KI_TEST::RET_CODES::OK : KI_TEST::RET_CODES::BAD_CMDLINE;
85 }
86
87
88#if 0
89 long iter_limit = 256;
90 long steps_limit = -1;
91 cl_parser.Found( "iteration-limit", &iter_limit );
92 cl_parser.Found( "steps-limit", &steps_limit );
93#endif
94
95 auto frame = new PNS_LOG_VIEWER_FRAME( nullptr );
96
97 if( cl_parser.GetParamCount() > 0 )
98 {
99 frame->LoadLogFile( cl_parser.GetParam( 0 ) );
100 }
101
102 return 0;
103}
104
105
107 "replay",
108 "PNS Log Player",
110} );
static bool Register(const KI_TEST::UTILITY_PROGRAM &aProgInfo)
Register a utility program factory function against an ID string.
static bool registered
static const wxCmdLineEntryDesc g_cmdLineDesc[]
#define _(s)
@ OK
Tool exited OK.
@ BAD_CMDLINE
The command line was not correct for the tool.
int replay_main_func(int argc, char *argv[])