()
override;
63arg_desc->SetUsageContext(
"",
"Suspect Product Rules to FSM");
66SetupArgDescriptions(arg_desc.release());
73 str.reserve(s.size() + 2);
95 boolneedopen =
false;
100 unsigned charch = *ptr++; --
size;
101 if(ch ==
'"'|| ch < 32 || ch >= 128) {
134 unsigned charch = *ptr++; --
size;
136ostr <<
"0x"<< temp <<
", ";
145 staticconstexpr
size_tm_buffer_size = 64;
149m_buffer.reset(
new char[m_buffer_size]);
150_MyBase::setp(m_buffer.get(), m_buffer.get() + m_buffer_size);
173 size_t size= pptr() - pbase();
176_MyBase::setp(m_buffer.get(), m_buffer.get() + m_buffer_size);
180std::ostream * m_ostr =
nullptr;
183 static constpair<string, CMultipatternSearch::TFlags>
FlagNames[] = {
199 auto types= istr->GuessDataType({CSuspect_rule_set::GetTypeInfo()});
200 if(
types.size() != 1 || *
types.begin() != CSuspect_rule_set::GetTypeInfo())
210*istr >> ProductRules;
215 for(
autorule : ProductRules.
Get()) {
216 patterns.push_back(rule->GetFind().GetRegex());
221 "// This code was generated by the prt2fsm application.\n" 222 "// (see .../src/app/prt2fsm)\n" 226 if(!filename.empty()) {
227ostr <<
" -i "<< filename;
232ostr <<
"// Binary ASN.1 of CSuspect_rule_set object\n";
233ostr <<
"NCBI_FSM_RULES = {\n";
237std::ostream
str(&
buf);
239*objostr << ProductRules;
243 FSM.GenerateArrayMapData(ostr);
250vector<pair<string, CMultipatternSearch::TFlags>> input;
254 while(std::getline(
file, line)) {
259 if((m = line.find(
"//")) != string::npos) {
260comment = line.substr(m);
261line = line.substr(0, m);
263 if((m = line.find_first_not_of(
" \t")) != string::npos) {
264line = line.substr(m);
266 if((m = line.find_last_not_of(
" \t")) != string::npos) {
267line = line.substr(0, m + 1);
269 unsigned int flags= 0;
271 if(comment.find(
f.first) != string::npos) {
275input.push_back(pair<string, unsigned int>(line,
flags));
279 if((m = fname.find_last_of(
"\\/")) != string::npos) {
280fname = fname.substr(m + 1);
283 for(
size_t i= 1;
i<= args.GetNExtra();
i++) {
284 stringparam = args[
"#"+ to_string(
i)].AsString();
285params +=
" "+ param;
286input.push_back(pair<string, unsigned int>(param, 0));
292 FSM.AddPatterns(input);
298ostr <<
"//\n// This code was generated by the multipattern application.\n//\n// Command line:\n// multipattern -A";
299 if(!fname.empty()) {
300ostr <<
" -i "<< fname;
303 FSM.GenerateArrayMapData(ostr);
317fname = args[
"i"].AsString();
320std::ostream* ostr = &std::cout;
322ostr = &args[
"o"].AsOutputFile();
324ifstream
file(fname);
337 int main(
intargc,
const char* argv[])
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
int_type overflow(int_type ch) override
std::unique_ptr< char > m_buffer
CBinaryToCPP(std::ostream &downstream)
std::basic_streambuf< char > _MyBase
int Run() override
Run the application.
void Init() override
Initialize the application.
Root class for all serialization exceptions.
static const char * str(char *buf, int n)
static const struct type types[]
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.
@ eInputFile
Name of file (must exist and be readable)
@ eOutputFile
Name of file (must be writable)
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
@ eSerial_AsnText
ASN.1 text.
@ eSerial_AsnBinary
ASN.1 binary.
static CObjectOStream * Open(ESerialDataFormat format, CNcbiOstream &outStream, bool deleteOutStream)
Create serial object writer and attach it to an output stream.
static CObjectIStream * Open(ESerialDataFormat format, CNcbiIstream &inStream, bool deleteInStream)
Create serial object reader and attach it to an input stream.
static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
void Run(void)
Enter the main loop.
const Tdata & Get(void) const
Get the member data.
Simultaneous search of multiple RegEx patterns in the input string.
const struct ncbi::grid::netcache::search::fields::SIZE size
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
#define GetArgs
Avoid preprocessor name clash with the NCBI C Toolkit.
bool xTryProductRules(const string &filename, std::istream &file, std::ostream &ostr)
void QuoteBinary(std::ostream &ostr, const char *ptr, size_t size)
void QuoteBinaryHex(std::ostream &ostr, const char *ptr, size_t size)
int main(int argc, const char *argv[])
string QuoteString(const string &s)
static const pair< string, CMultipatternSearch::TFlags > FlagNames[]
bool xTryTextFile(const string &fname, std::istream &file, std::ostream &ostr)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4