bin: overhaul default input selection

If no input have been specified, and the standard input is not a tty all
tools now default to reading it.  If standard input is a tty, all tools
display an error message.  Additionally, - is now a shorthand for -F- in
all tools.

* NEWS: Summarize this.
* bin/common_finput.cc, bin/common_finput.hh (check_no_formulas,
check_no_automaton): New functions that implement the above istty()
logic.
* bin/autfilt.cc, bin/dstar2tgba.cc, bin/ltl2tgba.cc, bin/ltl2tgta.cc,
bin/ltlcross.cc, bin/ltldo.cc, bin/ltlgrind.cc: Use these function,
and recognize '-' if it was not the case.
* tests/core/acc_word.test, tests/core/ltldo.test,
tests/core/minusx.test, tests/core/readsave.test,
tests/core/unambig.test: Adjust some tests to exercise this.
* doc/org/autfilt.org, doc/org/csv.org, doc/org/dstar2tgba.org,
doc/org/ltl2tgba.org, doc/org/ltlcross.org, doc/org/ltlfilt.org,
doc/org/oaut.org: Adjust the documentation and simplify some
examples.
This commit is contained in:
Alexandre Duret-Lutz 2016-07-19 21:55:12 +02:00
parent abff7eba8e
commit dd6875d5fe
22 changed files with 119 additions and 54 deletions

View file

@ -34,7 +34,7 @@ ltl2tgba -f 'a U b' |
ltl2tgba -f 'a U b' | autfilt --accept-word='cycle{!b}' -q && exit 1
# An example from the documentation:
randltl -n -1 a b | ltlfilt --simplify --uniq | ltl2tgba -F- |
randltl -n -1 a b | ltlfilt --simplify --uniq | ltl2tgba |
autfilt --accept-word='a&!b;cycle{!a&!b}' --accept-word='!a&!b;cycle{a&b}' \
--reject-word='cycle{b}' --stats=%M -n 3 > out
cat >expect <<EOF

View file

@ -44,7 +44,7 @@ diff output expected
# Test timeouts. This test should take 2*2 seconds.
$genltl --or-g=1..2 |
run 0 $ltldo -F- -t 'sleep 10; echo %f' -T1 -t 'sleep 10; echo %f' \
run 0 $ltldo -t 'sleep 10; echo %f' -T1 -t 'sleep 10; echo %f' \
>output 2>stderr
test -z "`cat output`"
test 4 = `grep -c warning: stderr`

View file

@ -22,7 +22,7 @@
set -e
# make sure option -x reports unknown arguments
ltl2tgba -F- -x foo </dev/null 2>error && exit 1
ltl2tgba - -x foo </dev/null 2>error && exit 1
grep "ltl2tgba: option 'foo' was not used" error
ltl2tgba -F- -x ba-simul,foo,bar </dev/null 2>error && exit 1
grep -v 'ba-simul' error

View file

@ -115,9 +115,8 @@ diff stdout stdout2
# exercise both %M and %m. The nonexistant file should never be
# open, because the input stream is infinite and autfilt should
# stop after 10 automata.
randltl -n -1 a b |
ltl2tgba -H -F - |
autfilt -F- -F nonexistant --states=3 --edges=..10 --acc-sets=1.. \
randltl -n -1 a b | ltl2tgba |
autfilt -F - -F nonexistant --states=3 --edges=..10 --acc-sets=1.. \
--name='%M, %S states' --stats='<%m>, %e, %a' -n 10 > output
cat >expected <<EOF
<F(b | Ga), 3 states>, 5, 1
@ -278,7 +277,7 @@ autfilt --merge -Hm input --name="%E->%e edges, %T->%t transitions" > output
diff output expected
cat <<EOF | ltl2tgba -x degen-lskip=1 -F- --ba -H > tmp.hoa
ltl2tgba -x degen-lskip=1 --ba > tmp.hoa <<EOF
a U b
false
!b && Xb && GFa

View file

@ -152,7 +152,7 @@ run 0 $autfilt --check input > output
test `grep -c unambiguous output` = 0
# Check 1000 random PSL formulas
randltl --psl -n 1000 3 | $ltl2tgba -U -F- -H |
randltl --psl -n 1000 3 | $ltl2tgba -U -H |
$autfilt -v --is-unamb --stats=%M && exit 1
cat >input <<EOF