aboutsummaryrefslogtreecommitdiff
path: root/src/bin/fstdraw.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/fstdraw.cc')
-rw-r--r--src/bin/fstdraw.cc23
1 files changed, 9 insertions, 14 deletions
diff --git a/src/bin/fstdraw.cc b/src/bin/fstdraw.cc
index 51ebb2d..98f8ff4 100644
--- a/src/bin/fstdraw.cc
+++ b/src/bin/fstdraw.cc
@@ -26,8 +26,6 @@ DEFINE_string(isymbols, "", "Input label symbol table");
DEFINE_string(osymbols, "", "Output label symbol table");
DEFINE_string(ssymbols, "", "State label symbol table");
DEFINE_bool(numeric, false, "Print numeric labels");
-DEFINE_string(save_isymbols, "", "Save input symbol table to file");
-DEFINE_string(save_osymbols, "", "Save output symbol table to file");
DEFINE_int32(precision, 5, "Set precision (number of char/float)");
DEFINE_bool(show_weight_one, false,
"Print/draw arc weights and final weights equal to Weight::One()");
@@ -51,10 +49,10 @@ int main(int argc, char **argv) {
string usage = "Prints out binary FSTs in dot text format.\n\n Usage: ";
usage += argv[0];
- usage += " [binary.fst [text.fst]]\n";
+ usage += " [binary.fst [text.dot]]\n";
std::set_new_handler(FailedNewHandler);
- SetFlags(usage.c_str(), &argc, &argv, true);
+ SET_FLAGS(usage.c_str(), &argc, &argv, true);
if (argc > 3) {
ShowUsage();
return 1;
@@ -65,7 +63,7 @@ int main(int argc, char **argv) {
s::FstClass *fst = s::FstClass::Read(in_name);
if (!fst) return 1;
- ostream *ostrm = &std::cout;
+ ostream *ostrm = &cout;
string dest = "stdout";
if (argc == 3) {
dest = argv[2];
@@ -79,13 +77,16 @@ int main(int argc, char **argv) {
const SymbolTable *isyms = 0, *osyms = 0, *ssyms = 0;
+ fst::SymbolTableTextOptions opts;
+ opts.allow_negative = FLAGS_allow_negative_labels;
+
if (!FLAGS_isymbols.empty() && !FLAGS_numeric) {
- isyms = SymbolTable::ReadText(FLAGS_isymbols, FLAGS_allow_negative_labels);
+ isyms = SymbolTable::ReadText(FLAGS_isymbols, opts);
if (!isyms) exit(1);
}
if (!FLAGS_osymbols.empty() && !FLAGS_numeric) {
- osyms = SymbolTable::ReadText(FLAGS_osymbols, FLAGS_allow_negative_labels);
+ osyms = SymbolTable::ReadText(FLAGS_osymbols, opts);
if (!osyms) exit(1);
}
@@ -106,13 +107,7 @@ int main(int argc, char **argv) {
FLAGS_fontsize, FLAGS_precision,
FLAGS_show_weight_one, ostrm, dest);
- if (isyms && !FLAGS_save_isymbols.empty())
- isyms->WriteText(FLAGS_save_isymbols);
-
- if (osyms && !FLAGS_save_osymbols.empty())
- osyms->WriteText(FLAGS_save_osymbols);
-
- if (ostrm != &std::cout)
+ if (ostrm != &cout)
delete ostrm;
return 0;
}