📄 compact.cpp
字号:
#include <astl.h>#include <dfa.h>#include <tools.h>#include <ccopy.h>#include <cursor.h>#include <stream.h>const string USAGE = "[-o] file";const string DESCRIPTION = "compact DFA read from stdin to file\n \-o\ttry to optimize space";ofstream output;int optimize;template <typename DFA>void run(DFA& dfa, const config &c){ dfa.initial(clone(dfa, clone_cursor<plain>(cin))); DFA_compact<DFA> cmp(dfa, optimize); if (c.verbose_mode) cmp.stats(cerr); cmp.write(output); cerr << c.argv[0] << ": compact DFA written to " << c.argv[c.arg_pos] << endl;} int main(int argc, char** argv){ config c(argc, argv, 1, "map bin", USAGE, DESCRIPTION); if (find(c.options.begin(), c.options.end(), string("-o")) != c.options.end()) optimize = 20; else optimize = 2; if (c.verbose_mode) cerr << c.argv[0] << ": optimize " << (optimize == 0 ? "yes" : "no") << endl; if (c.arg_pos < argc) output.open(argv[c.arg_pos]); else c.usage(); if (!output) { string msg = string(argv[0]) + ": "; perror(msg.c_str()); exit(2); } if (c.representation == "map") { DFA_map<> dfa; run(dfa, c); } if (c.representation == "bin") { DFA_bin<> dfa; run(dfa, c); } return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -