44 virtual void Init(
void);
45 virtual int Run (
void);
56 arg_desc->SetUsageContext(
GetArguments().GetProgramBasename(),
"Multipattern Search Code Generator");
57 arg_desc->AddFlag(
"A",
"Generate an array/map data");
58 arg_desc->AddFlag(
"D",
"Generate DOT graph");
65 static const pair<string, CMultipatternSearch::TFlags>
FlagNames[] = {
78 vector<pair<string, CMultipatternSearch::TFlags>>
input;
83 fname = args[
"i"].AsString();
86 cerr <<
"Cannot open file \'" << fname <<
"\'\n";
91 while (std::getline(
file, line)) {
96 if ((m = line.find(
"//")) != string::npos) {
97 comment = line.substr(m);
98 line = line.substr(0, m);
100 if ((m = line.find_first_not_of(
" \t")) != string::npos) {
101 line = line.substr(m);
103 if ((m = line.find_last_not_of(
" \t")) != string::npos) {
104 line = line.substr(0, m + 1);
106 unsigned int flags = 0;
108 if (comment.find(
f.first) != string::npos) {
112 input.push_back(pair<string, unsigned int>(line,
flags));
114 if ((m = fname.find_last_of(
"\\/")) != string::npos) {
115 fname = fname.substr(m + 1);
120 string param = args[
"#" + to_string(
i)].AsString();
121 params +=
" " + param;
122 input.push_back(pair<string, unsigned int>(param, 0));
133 FSM.GenerateDotGraph(cout);
135 else if (args[
"A"]) {
136 cout <<
"//\n// This code was generated by the multipattern application.\n//\n// Command line:\n// multipattern -A";
137 if (!fname.empty()) {
138 cout <<
" -i " << fname;
141 FSM.GenerateArrayMapData(cout);
144 cout <<
"//\n// This code was generated by the multipattern application.\n//\n// Command line:\n// multipattern";
145 if (!fname.empty()) {
146 cout <<
" -i " << fname;
149 FSM.GenerateSourceCode(cout);
156 int main(
int argc,
const char* argv[])
virtual int Run(void)
Run the application.
virtual void Init(void)
Initialize the application.
virtual const CArgs & GetArgs(void) const
Get parsed command line arguments.
int AppMain(int argc, const char *const *argv, const char *const *envp=0, EAppDiagStream diag=eDS_Default, const char *conf=NcbiEmptyCStr, const string &name=NcbiEmptyString)
Main function (entry point) for the NCBI application.
virtual void SetupArgDescriptions(CArgDescriptions *arg_desc)
Setup the command line argument descriptions.
const CNcbiArguments & GetArguments(void) const
Get the application's cached unprocessed command-line arguments.
size_t GetNExtra(void) const
Get the number of unnamed positional (a.k.a. extra) args.
@ eInputFile
Name of file (must exist and be readable)
@ eString
An arbitrary string.
int main(int argc, const char *argv[])
static const pair< string, CMultipatternSearch::TFlags > FlagNames[]
Simultaneous search of multiple RegEx patterns in the input string.
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
double f(double x_, const double &y_)