Commit c99532c6 authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz
Browse files

Add option to list commands with their input and output specifications.

* taf-kit/src/main.cc: Add option --list-all-commands-json.
* taf-kit/src/Makefile.am: #define the name of all contexts
for all instances.
* taf-kit/src/commands.hh, taf-kit/src/commands.cc:
Add new specifiers to describe parameters, and implement
a list_json() method.
* taf-kit/src/cmd_wt.cc, taf-kit/src/cmd_b.cc,
taf-kit/src/cmd_fmp.cc, taf-kit/src/cmd_gen.cc,
taf-kit/src/cmd_io.cc, taf-kit/src/cmd_pair.cc,
taf-kit/src/cmd_r.cc, taf-kit/src/cmd_wt.cc: Specify output.
parent 0c520ba1
2011-11-20 Alexandre Duret-Lutz <adl@lrde.epita.fr>
Add option to list commands with their input and output specifications.
* taf-kit/src/main.cc: Add option --list-all-commands-json.
* taf-kit/src/Makefile.am: #define the name of all contexts
for all instances.
* taf-kit/src/commands.hh, taf-kit/src/commands.cc:
Add new specifiers to describe parameters, and implement
a list_json() method.
* taf-kit/src/cmd_wt.cc, taf-kit/src/cmd_b.cc,
taf-kit/src/cmd_fmp.cc, taf-kit/src/cmd_gen.cc,
taf-kit/src/cmd_io.cc, taf-kit/src/cmd_pair.cc,
taf-kit/src/cmd_r.cc, taf-kit/src/cmd_wt.cc: Specify output.
2011-09-28 Alexandre Duret-Lutz <adl@lrde.epita.fr>
 
* doc/NEWS.txt: Fix formatting.
......
......@@ -28,7 +28,7 @@ bin_PROGRAMS = vcsn-char-b vcsn-char-z vcsn-char-r vcsn-char-fmp-b \
COMMON_SOURCES = commands.hh \
commands.cc \
common.hh \
cmd_io.cc \
cmd_io.cc \
cmd_gen.cc \
edition_commands.hh \
edition_commands.hxx \
......@@ -54,7 +54,8 @@ COMMON_SOURCES = commands.hh \
vcsn_char_b_SOURCES = $(COMMON_SOURCES) cmd_wt.cc cmd_b.cc
vcsn_char_b_CPPFLAGS = $(AM_CPPFLAGS) -DDUPBOOL \
-DCONTEXT=boolean_automaton \
-DCONTEXTS='"char-b", "char-b", "char-fmp-b"' \
-DCONTEXT=boolean_automaton \
-DBOOL_CONTEXT=boolean_automaton -DBOOL_DIR='"char-b"' \
-DFMPI_CONTEXT=fmp_transducer -DVCSN_USE_LIB
vcsn_char_b_LDADD = $(LDADD) $(top_builddir)/lib/libvcsn-b.la \
......@@ -62,6 +63,7 @@ vcsn_char_b_LDADD = $(LDADD) $(top_builddir)/lib/libvcsn-b.la \
vcsn_char_z_SOURCES = $(COMMON_SOURCES) cmd_wt.cc
vcsn_char_z_CPPFLAGS = $(AM_CPPFLAGS) -DCONTEXT=z_automaton \
-DCONTEXTS='"char-z", "char-b", "char-fmp-z"' \
-DBOOL_CONTEXT=boolean_automaton -DBOOL_DIR='"char-b"' \
-DFMPI_CONTEXT=z_fmp_transducer -DVCSN_USE_LIB \
-DWITH_WEIGHTS
......@@ -70,28 +72,32 @@ vcsn_char_z_LDADD = $(LDADD) $(top_builddir)/lib/libvcsn-z.la \
vcsn_char_r_SOURCES = $(COMMON_SOURCES) cmd_wt.cc cmd_r.cc
vcsn_char_r_CPPFLAGS = $(AM_CPPFLAGS) -DCONTEXT=r_automaton \
-DCONTEXTS='"char-r", "char-b", "char-fmp-r"' \
-DBOOL_CONTEXT=boolean_automaton -DBOOL_DIR='"char-b"' \
-DVCSN_USE_LIB -DWITH_WEIGHTS
vcsn_char_r_LDADD = $(LDADD) $(top_builddir)/lib/libvcsn-r.la
vcsn_char_q_SOURCES = $(COMMON_SOURCES) cmd_wt.cc cmd_r.cc
vcsn_char_q_CPPFLAGS = $(AM_CPPFLAGS) -DCONTEXT=q_automaton \
-DCONTEXTS='"char-q", "char-b", "char-fmp-q"' \
-DBOOL_CONTEXT=boolean_automaton -DBOOL_DIR='"char-b"' \
-DVCSN_USE_LIB -DWITH_WEIGHTS
vcsn_char_q_LDADD = $(LDADD) $(top_builddir)/lib/libvcsn-q.la
vcsn_char_f2_SOURCES = $(COMMON_SOURCES) cmd_wt.cc cmd_r.cc
vcsn_char_f2_CPPFLAGS = $(AM_CPPFLAGS) -DCONTEXT=f2_automaton \
-DBOOL_CONTEXT=boolean_automaton -DBOOL_DIR='"char-b"' \
-DCONTEXTS='"char-f2", "char-b", "char-fmp-f2"' \
-DBOOL_CONTEXT=boolean_automaton -DBOOL_DIR='"char-b"' \
-DVCSN_USE_LIB -DWITH_WEIGHTS
vcsn_char_f2_LDADD = $(LDADD) $(top_builddir)/lib/libvcsn-f2.la
vcsn_char_fmp_b_SOURCES = $(COMMON_SOURCES) cmd_fmp.cc
vcsn_char_fmp_b_CPPFLAGS = $(AM_CPPFLAGS) \
-DCONTEXTS='"char-fmp-b", "char-b", "char-char-b", "char-b", "char-b", "char-rw-char-b"' \
-DCONTEXT=fmp_transducer -DWITH_TWO_ALPHABETS \
-DIOAUT_NAME='"Boolean"' \
-DIOAUT_CONTEXT=boolean_automaton \
-DBOOL_CONTEXT=boolean_automaton \
-DBOOL_CONTEXT=boolean_automaton \
-DBOOL_DIR='"char-b"' -DDUPBOOL \
-DRW_CONTEXT=boolean_transducer -DVCSN_USE_LIB
vcsn_char_fmp_b_LDADD = $(LDADD) \
......@@ -101,10 +107,11 @@ vcsn_char_fmp_b_LDADD = $(LDADD) \
vcsn_char_fmp_z_SOURCES = $(COMMON_SOURCES) cmd_fmp.cc
vcsn_char_fmp_z_CPPFLAGS = $(AM_CPPFLAGS) \
-DCONTEXTS='"char-fmp-z", "char-fmp-b", "char-char-z", "char-z", "char-z", "char-rw-char-z"' \
-DCONTEXT=z_fmp_transducer -DWITH_TWO_ALPHABETS \
-DIOAUT_NAME='"Z"' \
-DIOAUT_CONTEXT=z_automaton \
-DBOOL_CONTEXT=boolean_automaton \
-DBOOL_CONTEXT=boolean_automaton \
-DBOOL_DIR='"char-b"' \
-DRW_CONTEXT=z_transducer -DVCSN_USE_LIB \
-DWITH_WEIGHTS
......@@ -115,15 +122,17 @@ vcsn_char_fmp_z_LDADD = $(LDADD) \
vcsn_int_b_SOURCES = $(COMMON_SOURCES) cmd_wt.cc cmd_b.cc
vcsn_int_b_CPPFLAGS = $(AM_CPPFLAGS) -DCONTEXT=int_boolean_automaton \
-DCONTEXTS='"int-b", "int-b", "int-fmp-b"' \
-DBOOL_CONTEXT=int_boolean_automaton \
-DBOOL_DIR='"int-b"' -DDUPBOOL \
-DBOOL_DIR='"int-b"' -DDUPBOOL \
-DFMPI_CONTEXT=int_fmp_transducer \
-DNO_PREDEF_ALPHABETS -DVCSN_USE_LIB
vcsn_int_b_LDADD = $(LDADD) $(top_builddir)/lib/libvcsn-int-b.la \
$(top_builddir)/lib/libvcsn-int-fmp-tdc.la
$(top_builddir)/lib/libvcsn-int-fmp-tdc.la
vcsn_int_z_SOURCES = $(COMMON_SOURCES) cmd_wt.cc
vcsn_int_z_CPPFLAGS = $(AM_CPPFLAGS) -DCONTEXT=int_z_automaton \
-DCONTEXTS='"int-z", "int-z", "int-fmp-z"' \
-DBOOL_CONTEXT=int_boolean_automaton \
-DBOOL_DIR='"int-b"' \
-DFMPI_CONTEXT=int_z_fmp_transducer \
......@@ -134,12 +143,13 @@ vcsn_int_z_LDADD = $(LDADD) $(top_builddir)/lib/libvcsn-int-z.la \
vcsn_int_fmp_b_SOURCES = $(COMMON_SOURCES) cmd_fmp.cc
vcsn_int_fmp_b_CPPFLAGS = $(AM_CPPFLAGS) -DCONTEXT=int_fmp_transducer \
-DCONTEXTS='"int-fmp-b", "int-fmp-b", "int-int-b", "int-b", "int-b", "int-rw-int-b"' \
-DNO_PREDEF_ALPHABETS -DWITH_TWO_ALPHABETS \
-DIOAUT_NAME='"Boolean"' \
-DIOAUT_CONTEXT=int_boolean_automaton \
-DBOOL_CONTEXT=int_boolean_automaton \
-DBOOL_CONTEXT=int_boolean_automaton \
-DBOOL_DIR='"int-b"' \
-DDUPBOOL \
-DDUPBOOL \
-DRW_CONTEXT=int_boolean_transducer -DVCSN_USE_LIB
vcsn_int_fmp_b_LDADD = $(LDADD) \
$(top_builddir)/lib/libvcsn-int-b.la \
......@@ -148,11 +158,12 @@ vcsn_int_fmp_b_LDADD = $(LDADD) \
vcsn_int_fmp_z_SOURCES = $(COMMON_SOURCES) cmd_fmp.cc
vcsn_int_fmp_z_CPPFLAGS = $(AM_CPPFLAGS) -DCONTEXT=int_z_fmp_transducer \
-DCONTEXTS='"int-fmp-z", "int-fmp-b", "int-int-z", "int-z", "int-z", "int-rw-int-z"' \
-DNO_PREDEF_ALPHABETS -DWITH_TWO_ALPHABETS \
-DIOAUT_NAME='"Z"' \
-DIOAUT_CONTEXT=int_z_automaton \
-DRW_CONTEXT=int_z_transducer -DWITH_WEIGHTS \
-DBOOL_CONTEXT=int_boolean_automaton \
-DBOOL_CONTEXT=int_boolean_automaton \
-DBOOL_DIR='"int-b"' \
-DVCSN_USE_LIB
vcsn_int_fmp_z_LDADD = $(LDADD) \
......@@ -162,9 +173,10 @@ vcsn_int_fmp_z_LDADD = $(LDADD) \
vcsn_char_char_b_SOURCES = $(COMMON_SOURCES) cmd_wt.cc cmd_b.cc cmd_pair.cc
vcsn_char_char_b_CPPFLAGS = $(AM_CPPFLAGS) -DCONTEXT=char_char_boolean_automaton \
-DCONTEXTS='"char-char-b", "char-char-b", "char-fmp-b", "char-b", "char-b"' \
-DBOOL_CONTEXT=char_char_boolean_automaton \
-DBOOL_DIR='"char-char-b"' \
-DDUPBOOL \
-DDUPBOOL \
-DVCSN_USE_LIB -DNO_PREDEF_ALPHABETS \
-DFMP_CONTEXT=fmp_transducer \
-DFIRST_PROJECTION_CONTEXT=boolean_automaton \
......@@ -174,6 +186,7 @@ vcsn_char_char_b_LDADD = $(LDADD) $(top_builddir)/lib/libvcsn-char-char-b.la
vcsn_char_char_z_SOURCES = $(COMMON_SOURCES) cmd_wt.cc cmd_pair.cc
vcsn_char_char_z_CPPFLAGS = $(AM_CPPFLAGS) -DCONTEXT=char_char_z_automaton \
-DCONTEXTS='"char-char-z", "char-char-b", "char-fmp-z", "char-z", "char-z"' \
-DBOOL_CONTEXT=char_char_boolean_automaton \
-DBOOL_DIR='"char-char-b"' \
-DVCSN_USE_LIB -DNO_PREDEF_ALPHABETS \
......@@ -185,9 +198,10 @@ vcsn_char_char_z_LDADD = $(LDADD) $(top_builddir)/lib/libvcsn-char-char-z.la
vcsn_char_int_b_SOURCES = $(COMMON_SOURCES) cmd_wt.cc cmd_b.cc cmd_pair.cc
vcsn_char_int_b_CPPFLAGS = $(AM_CPPFLAGS) -DCONTEXT=char_int_boolean_automaton \
-DCONTEXTS='"char-int-b", "char-int-b", "unsupported", "char-b", "int-b"' \
-DBOOL_CONTEXT=char_int_boolean_automaton \
-DBOOL_DIR='"char-int-b"' \
-DDUPBOOL \
-DDUPBOOL \
-DVCSN_USE_LIB -DNO_PREDEF_ALPHABETS \
-DFIRST_PROJECTION_CONTEXT=boolean_automaton \
-DSECOND_PROJECTION_CONTEXT=int_boolean_automaton
......@@ -195,6 +209,7 @@ vcsn_char_int_b_LDADD = $(LDADD) $(top_builddir)/lib/libvcsn-char-int-b.la
vcsn_int_int_b_SOURCES = $(COMMON_SOURCES) cmd_wt.cc cmd_b.cc cmd_pair.cc
vcsn_int_int_b_CPPFLAGS = $(AM_CPPFLAGS) -DCONTEXT=int_int_boolean_automaton \
-DCONTEXTS='"int-int-b", "int-int-b", "int-fmp-b", "int-b", "int-b"' \
-DBOOL_CONTEXT=int_int_boolean_automaton \
-DBOOL_DIR='"int-int-b"' \
-DDUPBOOL \
......@@ -207,6 +222,7 @@ vcsn_int_int_b_LDADD = $(LDADD) $(top_builddir)/lib/libvcsn-int-int-b.la
vcsn_int_int_z_SOURCES = $(COMMON_SOURCES) cmd_wt.cc cmd_pair.cc
vcsn_int_int_z_CPPFLAGS = $(AM_CPPFLAGS) -DCONTEXT=int_int_z_automaton \
-DCONTEXTS='"int-int-z", "int-int-b", "fmp-int-z", "int-z", "int-z"' \
-DBOOL_CONTEXT=int_int_boolean_automaton \
-DBOOL_DIR='"int-int-b"' \
-DVCSN_USE_LIB -DNO_PREDEF_ALPHABETS \
......@@ -218,6 +234,7 @@ vcsn_int_int_z_LDADD = $(LDADD) $(top_builddir)/lib/libvcsn-int-int-z.la
vcsn_char_zmin_SOURCES = $(COMMON_SOURCES) cmd_wt.cc
vcsn_char_zmin_CPPFLAGS = $(AM_CPPFLAGS) -DCONTEXT=z_min_plus_automaton \
-DCONTEXTS='"char-zmin", "char-b", "char-fmp-zmin"' \
-DBOOL_CONTEXT=boolean_automaton \
-DBOOL_DIR='"char-b"' \
-DVCSN_USE_LIB -DWITH_WEIGHTS
......@@ -225,6 +242,7 @@ vcsn_char_zmin_LDADD = $(LDADD) $(top_builddir)/lib/libvcsn-z-min.la
vcsn_char_zmax_SOURCES = $(COMMON_SOURCES) cmd_wt.cc
vcsn_char_zmax_CPPFLAGS = $(AM_CPPFLAGS) -DCONTEXT=z_max_plus_automaton \
-DCONTEXTS='"char-zmax", "char-b", "char-fmp-zmax"' \
-DBOOL_CONTEXT=boolean_automaton \
-DBOOL_DIR='"char-b"' \
-DVCSN_USE_LIB -DWITH_WEIGHTS
......
......@@ -167,33 +167,37 @@ universal_command(const arguments_t& args)
BEGIN_COMMAND_GROUP(b_commands,
"4. Algorithms specific to Boolean automata and rational expressions:");
COMMAND_ENTRY(is_complete, Aut,
COMMAND_ENTRY(is_complete, Aut, Boolean,
"Return whether `aut' is complete.");
COMMAND_ENTRY(complete, Aut, "Give the complete version of `aut'.");
COMMAND_ENTRY(is_deterministic, Aut,
COMMAND_ENTRY(complete, Aut, Aut, "Give the complete version of `aut'.");
COMMAND_ENTRY(is_deterministic, Aut, Boolean,
"Return whether `aut' is deterministic.");
COMMAND_ENTRY(determinize, Aut,
COMMAND_ENTRY(determinize, Aut, Aut,
"Give the determinized automaton of `aut'.");
COMMAND_ENTRY(complement, Aut, "Complement `aut'.");
COMMAND_ENTRY(complement, Aut, Aut, "Complement `aut'.");
COMMAND_ENTRY_CN(minimize, minimization_hopcroft, Aut,
COMMAND_ENTRY_CN(minimize, minimization_hopcroft, Aut, Aut,
"Give the minimized of `aut' (Hopcroft algorithm).");
COMMAND_ENTRY_EXPERT_CN(minimize-moore, minimization_moore, Aut,
COMMAND_ENTRY_EXPERT_CN(minimize-moore, minimization_moore, Aut, Aut,
"Give the minimized of `aut' (Moore algorithm).");
COMMAND_ENTRY(intersection, AutAut, "Build the intersection of two automata.");
COMMAND_ENTRY(are_equivalent, AutAut,
COMMAND_ENTRY(intersection, AutAut, Aut,
"Build the intersection of two automata.");
COMMAND_ENTRY(are_equivalent, AutAut, Boolean,
"Return whether `aut1' and `aut2' realize the same series.");
COMMAND_ENTRY(are_equivalent_E, ExpExp,
COMMAND_ENTRY(are_equivalent_E, ExpExp, Boolean,
"Return whether `exp1' and `exp2' denote the same language.");
COMMAND_ENTRY(derived_term, Exp,
COMMAND_ENTRY(derived_term, Exp, Aut,
"Build the derivate-term automaton for `exp'.");
COMMAND_ENTRY(shortest, Aut, "Return one of the shortest accepted words.");
COMMAND_ENTRY(enumerate, AutInt, "Enumerate all accepted words of length <=n.");
COMMAND_ENTRY(prefix, Aut,
COMMAND_ENTRY(shortest, Aut, Text,
"Return one of the shortest accepted words.");
COMMAND_ENTRY(enumerate, AutInt, Text,
"Enumerate all accepted words of length <=n.");
COMMAND_ENTRY(prefix, Aut, Aut,
"Build an automaton which accepts any prefix of Aut.");
COMMAND_ENTRY(suffix, Aut,
COMMAND_ENTRY(suffix, Aut, Aut,
"Build an automaton which accepts any suffix of Aut.");
COMMAND_ENTRY(factor, Aut,
COMMAND_ENTRY(factor, Aut, Aut,
"Build an automaton which accepts any factor of Aut.");
COMMAND_ENTRY(universal, Aut, "Build the universal automaton of an automaton.");
COMMAND_ENTRY(universal, Aut, Aut,
"Build the universal automaton of an automaton.");
END_COMMAND_GROUP
......@@ -254,48 +254,50 @@ to_rw_command(const arguments_t& args)
BEGIN_COMMAND_GROUP(fmp_commands,
"5. Algorithms for automata on products of free monoïds:");
COMMAND_ENTRY(inverse, Aut, "Give the inverse of `aut'.");
COMMAND_ENTRY(transpose, Aut,
COMMAND_ENTRY(inverse, Aut, Aut, "Give the inverse of `aut'.");
COMMAND_ENTRY(transpose, Aut, Aut,
"Give the transposed of the transducer `aut'.");
COMMAND_ENTRY(is_subnormalized, Aut, "Tell whether `aut' is sub-normalized.");
COMMAND_ENTRY(subnormalize, Aut,
COMMAND_ENTRY(is_subnormalized, Aut, Boolean,
"Tell whether `aut' is sub-normalized.");
COMMAND_ENTRY(subnormalize, Aut, Aut,
"Build a subnormalized transducer of `aut'.");
COMMAND_ENTRY_EXPERT(is_normalized, Aut,
COMMAND_ENTRY_EXPERT(is_normalized, Aut, Boolean,
"Return whether `aut' is normalized.");
COMMAND_ENTRY_EXPERT(normalize, Aut,
COMMAND_ENTRY_EXPERT(normalize, Aut, Aut,
"Build a normalized transducer for `aut'.");
COMMAND_ENTRY(is_ltl, Aut, "Test if `aut' is letter-to-letter.");
COMMAND_ENTRY(ltl_to_pair, Aut,
COMMAND_ENTRY(is_ltl, Aut, Boolean,
"Test if `aut' is letter-to-letter.");
COMMAND_ENTRY(ltl_to_pair, Aut, AutM,
"Convert `Aut' into an automaton defined over a pair letter alphabet.");
#ifndef WITH_WEIGHTS
COMMAND_ENTRY(b_composition, AutAut,
COMMAND_ENTRY(b_composition, AutAut, Aut,
"Compose two subnormalized transducers.");
COMMAND_ENTRY(b_composition_R, AutAut,
COMMAND_ENTRY(b_composition_R, AutAut, Aut,
"Compose two transducers.");
#endif
COMMAND_ENTRY_EXPERT(composition_cover, Aut, "Outsplitting.");
COMMAND_ENTRY_EXPERT(composition_co_cover, Aut, "Insplitting.");
COMMAND_ENTRY(composition, AutAut,
"Compose two subnormalized transducers, preserving the number of paths.");
COMMAND_ENTRY(composition_R, AutAut,
COMMAND_ENTRY_EXPERT(composition_cover, Aut, Aut, "Outsplitting.");
COMMAND_ENTRY_EXPERT(composition_co_cover, Aut, Aut, "Insplitting.");
COMMAND_ENTRY(composition, AutAut, Aut,
"Compose two subnormalized transducers, preserving the number of paths.");
COMMAND_ENTRY(composition_R, AutAut, Aut,
"Compose two transducers, preserving the number of paths.");
COMMAND_ENTRY(domain, Aut,
COMMAND_ENTRY(domain, Aut, Aut1,
"Give an automaton that accepts all inputs accepted by `aut'.");
COMMAND_ENTRY(w_domain, Aut,
"Give a weighted automaton that accepts all inputs accepted by `aut'.");
COMMAND_ENTRY(image, Aut,
COMMAND_ENTRY(w_domain, Aut, Aut1,
"Give a weighted automaton that accepts all inputs accepted by `aut'.");
COMMAND_ENTRY(image, Aut, Aut2,
"Give an automaton that accepts all output produced by `aut'.");
COMMAND_ENTRY(w_image, Aut,
"Give a weighted automaton that accepts all output produced by `aut'.");
COMMAND_ENTRY(evaluation, AutAut,
COMMAND_ENTRY(w_image, Aut, Aut2,
"Give a weighted automaton that accepts all output produced by `aut'.");
COMMAND_ENTRY(evaluation, AutAut1, Aut2,
"Evaluate the language described by the "
IOAUT_NAME " automaton `aut2' on the transducer `aut1'.");
COMMAND_ENTRY(eval, AutExp,
COMMAND_ENTRY(eval, AutExp1, Text,
"Give the evaluation of `exp' against `aut'.");
#ifdef RW_CONTEXT
COMMAND_ENTRY_EXPERT(to_rw, Aut,
COMMAND_ENTRY_EXPERT(to_rw, Aut, AutR,
"Give the equivalent rational weight transducer of `aut'.");
#endif
END_COMMAND_GROUP
......@@ -300,51 +300,52 @@ semiring_info_command(const arguments_t& args)
BEGIN_COMMAND_GROUP(cmd_gen,
"1. Operations on all automata and rational expressions:");
// Graphs
COMMAND_ENTRY(accessible, Aut, "Compute the accessible part of `aut'.");
COMMAND_ENTRY(coaccessible, Aut, "Compute the co-accessible part of `aut'.");
COMMAND_ENTRY(is_trim, Aut, "Test if the `aut' is trim.");
COMMAND_ENTRY(trim, Aut, "Compute the trim part of `aut'.");
COMMAND_ENTRY(is_empty, Aut, "Tell whether `aut' is empty.'")
COMMAND_ENTRY(is_useless, Aut,
COMMAND_ENTRY(accessible, Aut, Aut, "Compute the accessible part of `aut'.");
COMMAND_ENTRY(coaccessible, Aut, Aut,
"Compute the co-accessible part of `aut'.");
COMMAND_ENTRY(is_trim, Aut, Boolean, "Test if the `aut' is trim.");
COMMAND_ENTRY(trim, Aut, Aut, "Compute the trim part of `aut'.");
COMMAND_ENTRY(is_empty, Aut, Boolean, "Tell whether `aut' is empty.'")
COMMAND_ENTRY(is_useless, Aut, Boolean,
"Tell whether `aut' has a successful compitation.");
// Transformations
COMMAND_ENTRY(proper, Aut, "Compute a proper automaton equivalent to "
COMMAND_ENTRY(proper, Aut, Aut, "Compute a proper automaton equivalent to "
"`aut' by eliminating spontaneous transitions.");
COMMAND_ENTRY(is_proper, Aut,
COMMAND_ENTRY(is_proper, Aut, Boolean,
"Return whether `aut' has no spontaneous transitions.");
COMMAND_ENTRY_EXPERT(proper_sp, Aut, "Compute a proper automaton "
COMMAND_ENTRY_EXPERT(proper_sp, Aut, Aut, "Compute a proper automaton "
"equivalent to `aut' using shorter paths.");
COMMAND_ENTRY(is_standard, Aut, "Tell whethwe `aut' is standard");
COMMAND_ENTRY(standardize, Aut, "Give the standard automaton of `aut'.");
COMMAND_ENTRY(is_standard, Aut, Boolean, "Tell whethwe `aut' is standard");
COMMAND_ENTRY(standardize, Aut, Aut, "Give the standard automaton of `aut'.");
// Operations
COMMAND_ENTRY(union, AutAut,
COMMAND_ENTRY(union, AutAut, Aut,
"Build the union of two automata.");
COMMAND_ENTRY(sum, AutAut,
COMMAND_ENTRY(sum, AutAut, Aut,
"Build the sum of two standard automata.");
COMMAND_ENTRY(concatenate, AutAut,
COMMAND_ENTRY(concatenate, AutAut, Aut,
"Build the concatenation of two standard automata.");
COMMAND_ENTRY(chain, AutInt,
COMMAND_ENTRY(chain, AutInt, Aut,
"Concatenate a standard automaton n times with itself.");
COMMAND_ENTRY(star, Aut,
COMMAND_ENTRY(star, Aut, Aut,
"Build the star of a standard automaton.");
COMMAND_ENTRY(left_mult, AutWeight,
COMMAND_ENTRY(left_mult, AutWeight, Aut,
"Build the left-product of `aut' and `weight'.");
COMMAND_ENTRY(right_mult, AutWeight,
COMMAND_ENTRY(right_mult, AutWeight, Aut,
"Build the right-product of `aut' and `weight'.");
COMMAND_ENTRY(aut_to_exp, Aut,
COMMAND_ENTRY(aut_to_exp, Aut, Exp,
"Build an expression denoting the behaviour of `aut' (Naive heuristic).");
COMMAND_ENTRY(aut_to_exp_SO, Aut,
COMMAND_ENTRY(aut_to_exp_SO, Aut, Exp,
"Build an expression denoting the behaviour of `aut' (State order).");
COMMAND_ENTRY(aut_to_exp_DM, Aut,
COMMAND_ENTRY(aut_to_exp_DM, Aut, Exp,
"Build an expression denoting the behaviour of `aut' (Delgado & Morais heuristic).");
// Operations on behaviors
COMMAND_ENTRY(sum_S, AutAut,
COMMAND_ENTRY(sum_S, AutAut, Aut,
"Build a standard sum of two automata.");
COMMAND_ENTRY(cauchy_S, AutAut,
COMMAND_ENTRY(cauchy_S, AutAut, Aut,
"Build a standard Cauchy product of two automata.");
COMMAND_ENTRY(star_S, Aut,
COMMAND_ENTRY(star_S, Aut, Aut,
"Build a standard star of an automaton.");
// Miscelaneous commands
COMMAND_ENTRY_EXPERT(semiring_info, None,
COMMAND_ENTRY_EXPERT(semiring_info, None, Text,
"Debug information about the semiring.");
END_COMMAND_GROUP
......@@ -46,8 +46,8 @@ display_command(const arguments_t& args)
BEGIN_COMMAND_GROUP(io_commands,
"0. Input/Output functions:");
COMMAND_ENTRY(data, Aut, "Print useful infos about `aut'.");
COMMAND_ENTRY(cat, Aut, "Return `aut'.");
COMMAND_ENTRY(display, Aut, "Display `aut'.");
COMMAND_ENTRY(edit, Aut, "Create or edit an automaton interactively.");
COMMAND_ENTRY(data, Aut, Text, "Print useful infos about `aut'.");
COMMAND_ENTRY(cat, Aut, Aut, "Return `aut'.");
COMMAND_ENTRY(display, Aut, None, "Display `aut'.");
COMMAND_ENTRY(edit, Aut, None, "Create or edit an automaton interactively.");
END_COMMAND_GROUP
......@@ -54,10 +54,12 @@ pair_to_fmp_command(const arguments_t& args)
BEGIN_COMMAND_GROUP(pair_commands,
"6. Algorithms for automata with alphabets of pairs:");
COMMAND_ENTRY(first_projection, Aut, "Give the first projection of `aut'.");
COMMAND_ENTRY(second_projection, Aut, "Give the second projection of `aut'.");
COMMAND_ENTRY(first_projection, Aut, Aut1,
"Give the first projection of `aut'.");
COMMAND_ENTRY(second_projection, Aut, Aut2,
"Give the second projection of `aut'.");
#ifdef FMP_CONTEXT
COMMAND_ENTRY(pair_to_fmp, Aut,
COMMAND_ENTRY(pair_to_fmp, Aut, AutM,
"Convert an automata `Aut' using pair letters into an FMP.");
#endif
END_COMMAND_GROUP
......@@ -83,11 +83,12 @@ universal_command(const arguments_t& args)
BEGIN_COMMAND_GROUP(r_commands,
"3. Algorithms for automata with weights in a field:");
COMMAND_ENTRY(reduce, Aut,
COMMAND_ENTRY(reduce, Aut, Aut,
"Compute a minimal automaton equivalent to `aut'.");
COMMAND_ENTRY(are_equivalent, AutAut,
COMMAND_ENTRY(are_equivalent, AutAut, Boolean,
"Tell whether two automata realize the same series.");
COMMAND_ENTRY(are_equivalent_E, ExpExp,
COMMAND_ENTRY(are_equivalent_E, ExpExp, Boolean,
"Tell whether two expressions denote the same language.");
COMMAND_ENTRY(universal, Aut, "Build the universal automaton of an automaton.")
COMMAND_ENTRY(universal, Aut, Aut,
"Build the universal automaton of an automaton.")
END_COMMAND_GROUP
......@@ -250,32 +250,41 @@ support_command(const arguments_t& args)
BEGIN_COMMAND_GROUP(cmd_gen,
"2. Operations on weighted automata and expressions over free monoids:");
COMMAND_ENTRY(transpose, Aut, "Transpose the automaton `aut'.");
COMMAND_ENTRY(is_unambiguous, Aut,
COMMAND_ENTRY(transpose, Aut, Aut, "Transpose the automaton `aut'.");
COMMAND_ENTRY(is_unambiguous, Aut, Boolean,
"Return whether `aut' is unambiguous.");
COMMAND_ENTRY(is_realtime, Aut, "Tell whether `aut' is realtime.");
COMMAND_ENTRY(realtime, Aut, "Build a realtime version of `aut'.");
COMMAND_ENTRY(quotient, Aut, "Build the quotient of the realtime automaton `aut'.");
COMMAND_ENTRY(is_realtime, Aut, Boolean, "Tell whether `aut' is realtime.");
COMMAND_ENTRY(realtime, Aut, Aut, "Build a realtime version of `aut'.");
COMMAND_ENTRY(quotient, Aut, Aut,
"Build the quotient of the realtime automaton `aut'.");
#ifdef FMPI_CONTEXT
COMMAND_ENTRY(partial_identity, Aut,
COMMAND_ENTRY(partial_identity, Aut, AutM,
"Transform an automaton into an FMP "
"transducer by creating, for each word, "
"a pair containing twice this word.");
#endif
COMMAND_ENTRY(eval, AutWord, "Evaluate `word' on the realtime automaton `aut'.");
COMMAND_ENTRY(eval_S, AutWord, "Evaluate `word' on `aut'.");
COMMAND_ENTRY(eval, AutWord, Text,
"Evaluate `word' on the realtime automaton `aut'.");
COMMAND_ENTRY(eval_S, AutWord, Text, "Evaluate `word' on `aut'.");
// Operations on expressions
COMMAND_ENTRY(standard, Exp, "Build the standard automaton for `exp'.");
COMMAND_ENTRY(thompson, Exp, "Build the Thompson automaton for `exp'.");
COMMAND_ENTRY(cat_E, Exp, "Return `exp' after trivial simplifications.");
COMMAND_ENTRY(expand, Exp, "Distribute product over addition in `exp'.");
COMMAND_ENTRY(exp_to_aut, Exp, "Build the standard automaton for `exp'.");
COMMAND_ENTRY_EXPERT(realtime_E, Exp, "Make `exp' realtime.");
COMMAND_ENTRY(product, AutAut, "Build the product of two automata.");
COMMAND_ENTRY(shuffle, AutAut, "Build the shuffle product of two automata.");
COMMAND_ENTRY(infiltration, AutAut, "Build the infiltration product of two automata.");
COMMAND_ENTRY(power, AutInt, "Build the `n'th power of `aut'.");
COMMAND_ENTRY(characteristic, Aut, "Build an automaton from the Boolean automaton `aut'.");
COMMAND_ENTRY(support, Aut, "Build a Boolean automaton from `aut'.");
COMMAND_ENTRY(star_alphabet, None, "Build an automaton recognizing the free monoid generated by the alphabet.");
COMMAND_ENTRY(standard, Exp, Aut, "Build the standard automaton for `exp'.");
COMMAND_ENTRY(thompson, Exp, Aut, "Build the Thompson automaton for `exp'.");
COMMAND_ENTRY(cat_E, Exp, Exp, "Return `exp' after trivial simplifications.");
COMMAND_ENTRY(expand, Exp, Exp, "Distribute product over addition in `exp'.");
COMMAND_ENTRY(exp_to_aut, Exp, Aut, "Build the standard automaton for `exp'.");
COMMAND_ENTRY_EXPERT(realtime_E, Exp, Exp, "Make `exp' realtime.");
COMMAND_ENTRY(product, AutAut, Aut,
"Build the product of two automata.");
COMMAND_ENTRY(shuffle, AutAut, Aut,
"Build the shuffle product of two automata.");
COMMAND_ENTRY(infiltration, AutAut, Aut,
"Build the infiltration product of two automata.");
COMMAND_ENTRY(power, AutInt, Aut,
"Build the `n'th power of `aut'.");
COMMAND_ENTRY(characteristic, AutB, Aut,
"Build an automaton from the Boolean automaton `aut'.");
COMMAND_ENTRY(support, Aut, AutB,
"Build a Boolean automaton from `aut'.");
COMMAND_ENTRY(star_alphabet, None, Aut,
"Build an automaton recognizing the free monoid generated by the alphabet.");
END_COMMAND_GROUP
......@@ -19,6 +19,8 @@
#include <cassert>
#include <sstream>
static const char* contexts[] = { CONTEXTS };
command_map::map_t&
command_map::map_()
{
......@@ -31,6 +33,7 @@ command_map::register_cmd(const char* section,
const char* name,
int (*command)(const arguments_t&),
command_params params,
command_params output,
const char* docstring,
bool expert)
{
......@@ -38,11 +41,21 @@ command_map::register_cmd(const char* section,
switch (params)
{
case None: n_params = 0; break;
case Boolean: n_params = 1; break;
case Text: n_params = 1; break;
case Exp: n_params = 1; break;
case Exp1: n_params = 1; break;
case ExpExp: n_params = 2; break;
case Aut: n_params = 1; break;
case AutB: n_params = 1; break;
case AutM: n_params = 1; break;
case Aut1: n_params = 1; break;
case Aut2: n_params = 1; break;
case AutR: n_params = 1; break;
case AutExp: n_params = 2; break;
case AutExp1: n_params = 2; break;
case AutAut: n_params = 2; break;
case AutAut1: n_params = 2; break;
case AutInt: n_params = 2; break;
case AutWord: n_params = 2; break;
case AutWeight: n_params = 2; break;
......@@ -53,7 +66,8 @@ command_map::register_cmd(const char* section,
if (*i == '_')
*i = '-';
command_t p = { section, command, params, n_params, docstring, expert };
command_t p = { section, command, params, output,
n_params, docstring, expert };
map_()[s] = p;
}
......@@ -102,11 +116,16 @@ command_map::list(std::ostream& ostr, bool expert)
switch (command->params)
{
case None: break;
case Text: *out << " text"; break;
case Boolean: *out << " bool"; break;
case Exp: *out << " exp"; break;
case Exp1: *out << " exp"; break;
case ExpExp: *out << " exp1 exp2"; break;
case Aut: *out << " aut"; break;
case AutExp: *out << " aut exp"; break;
case AutExp1: *out << " aut exp"; break;
case AutAut: *out << " aut1 aut2"; break;
case AutAut1: *out << " aut1 aut2"; break;
case AutInt: *out << " aut n"; break;
case AutWord: *out << " aut word"; break;
case AutWeight: *out << " aut weight"; break;
......@@ -125,6 +144,176 @@ command_map::list(std::ostream& ostr, bool expert)
}
static
std::ostream&
param(std::ostream& ostr, command_params p)
{
switch (p)
{
case Text:
ostr << " { \"type\": \"text\" }";
break;
case Boolean:
ostr << " { \"type\": \"bool\" }";
break;
case Exp:
ostr << " { \"type\": \"exp\", \"context\": \"" << contexts[0] << "\" }";
break;
case Exp1:
ostr << " { \"type\": \"exp\", \"context\