|
wxMaxima
|
Turns wxMaxima's command line into settings; see CommandLine.h. More...
#include "CommandLine.h"#include "CommandLineOptions.h"#include <wx/filename.h>#include <wx/intl.h>#include <wx/msgout.h>#include <algorithm>#include <cctype>#include <string>Functions | |
| const wxCmdLineEntryDesc * | wxm::cmdline::ParserDescription () |
| The wxCmdLineParser description, made from wxm::cmdline::Options. | |
| std::vector< wxString > | wxm::cmdline::DiffAliasArguments (const std::vector< wxString > &args) |
| The arguments wxMaxima acts on, if it was started under this name. | |
| void | wxm::cmdline::SetArguments (wxCmdLineParser &parser, const std::vector< wxString > &args) |
| Hands an argument vector (program first) to the parser, unmodified. | |
| int | wxm::cmdline::Parse (wxCmdLineParser &parser, const std::vector< wxString > &args, bool showUsage=true) |
| Parses the arguments (program first) with wxMaxima's options. | |
| wxString | wxm::cmdline::CanonicalFileArgument (const wxString &arg) |
| A file name from the command line, made absolute. | |
| Settings | wxm::cmdline::Interpret (const wxCmdLineParser &parser) |
| Reads the settings out of a parser that has already run Parse() | |
Turns wxMaxima's command line into settings; see CommandLine.h.
| wxString wxm::cmdline::CanonicalFileArgument | ( | const wxString & | arg | ) |
| std::vector< wxString > wxm::cmdline::DiffAliasArguments | ( | const std::vector< wxString > & | args | ) |
The arguments wxMaxima acts on, if it was started under this name.
The first entry is the program itself. If that is called wxmxdiff and no –diff/-d was given, a -d is inserted right behind it, so "wxmxdiff a b" compares a and b. Otherwise the arguments are returned unchanged. A "-d" after "--" is a file name, not the switch, and so is one that is the value of an option ("--ini -d").
This used to re-join the arguments into one string and have wxCmdLineParser split that again. That string's first word was the program, which wxCmdLineParser takes as a parameter (it supplies the program name itself), so wxmxdiff compared the wxMaxima executable with the files; and an argument containing a quote was mangled on the way. Passing the vector through keeps every argument exactly as it was.
| Settings wxm::cmdline::Interpret | ( | const wxCmdLineParser & | parser | ) |
Reads the settings out of a parser that has already run Parse()
Only meaningful if Parse() returned 0; on an error main.cpp still looks at –single_process and –single_thread before it exits, so this doesn't refuse to run then.
| int wxm::cmdline::Parse | ( | wxCmdLineParser & | parser, |
| const std::vector< wxString > & | args, | ||
| bool | showUsage = true |
||
| ) |
Parses the arguments (program first) with wxMaxima's options.
| parser | A parser that has no description yet: this sets it. |
| args | The arguments, the program name first. |
| showUsage | Print the usage text along with an error message. |
The same as SetDesc(), SetArguments() and Parse(), except for one argument wxCmdLineParser can't cope with: an option starting with "--" and a character that can't be part of an option name, such as "--+" or "--=x". wxWidgets (3.2 up to at least 3.3) looks up the option's name, finds it empty, and asks the empty name for its last character – a failed assertion, followed by a read in front of the string. Found by fuzz_cmdline. Such an argument is harmless where it is a value (after "--", or after an option that takes one), so whether it is in the place of an option is asked of wxCmdLineParser itself: the arguments are parsed once with it replaced by an option name of our own, and if the parser complains about that name, the argument is reported as an unknown option instead of being handed to the real parse.
| const wxCmdLineEntryDesc * wxm::cmdline::ParserDescription | ( | ) |
The wxCmdLineParser description, made from wxm::cmdline::Options.
Points to a static, wxCMD_LINE_NONE-terminated array that lives as long as the program.