Commit 1ec29985 authored by Jerome Galtier's avatar Jerome Galtier
Browse files

Improve taf-kit support of fmp transducers.

	* configure.ac: New taf-kit instances.
	* lib/Makefile.am: Add libvcsn-int-fmp-z.
	* lib/generate_libvcsn.rb: New filters.
	* taf-kit/src/Makefile.am: Rename vcsn-*-fmp to vcsn-*-fmp-b,
	  and add vcsn-*-fmp-z, build with livcsn-int-fmp-z.
	* taf-kit/src/edition_commands.hxx: Use a new macro and improve
	  weight input.
	* taf-kit/tests/Makefile.am: Add new tests.
	* taf-kit/tests/vcsn-char-fmp-b.test: New.
	* taf-kit/tests/vcsn-char-fmp-z.test: New.
	* taf-kit/tests/vcsn-char-fmp.test: Remove.
	* taf-kit/tests/vcsn-int-fmp-b.test: New.
	* taf-kit/tests/vcsn-int-fmp-z.test: New.
	* taf-kit/tests/vcsn-int-fmp.test: Remove.
parent 08fc65f6
2008-08-20 Jerome Galtier <jerome.galtier@lrde.epita.fr>
Improve taf-kit support of fmp transducers.
* configure.ac: New taf-kit instances.
* lib/Makefile.am: Add libvcsn-int-fmp-z.
* lib/generate_libvcsn.rb: New filters.
* taf-kit/src/Makefile.am: Rename vcsn-*-fmp to vcsn-*-fmp-b,
and add vcsn-*-fmp-z, build with livcsn-int-fmp-z.
* taf-kit/src/edition_commands.hxx: Use a new macro and improve
weight input.
* taf-kit/tests/Makefile.am: Add new tests.
* taf-kit/tests/vcsn-char-fmp-b.test: New.
* taf-kit/tests/vcsn-char-fmp-z.test: New.
* taf-kit/tests/vcsn-char-fmp.test: Remove.
* taf-kit/tests/vcsn-int-fmp-b.test: New.
* taf-kit/tests/vcsn-int-fmp-z.test: New.
* taf-kit/tests/vcsn-int-fmp.test: Remove.
2008-08-18 Alexandre Duret-Lutz <adl@lrde.epita.fr>
* doc/manual/taf-kit.tex (subsection{First Contacts}): Typo.
......
......@@ -208,10 +208,12 @@ m4_define([VCSN_CONFIG_WRAPPER],
[chmod a+x taf-kit/tests/$1])
])
VCSN_CONFIG_WRAPPER([vcsn-char-b])
VCSN_CONFIG_WRAPPER([vcsn-char-fmp])
VCSN_CONFIG_WRAPPER([vcsn-char-fmp-b])
VCSN_CONFIG_WRAPPER([vcsn-char-fmp-z])
VCSN_CONFIG_WRAPPER([vcsn-char-z])
VCSN_CONFIG_WRAPPER([vcsn-int-b])
VCSN_CONFIG_WRAPPER([vcsn-int-fmp])
VCSN_CONFIG_WRAPPER([vcsn-int-fmp-b])
VCSN_CONFIG_WRAPPER([vcsn-int-fmp-z])
VCSN_CONFIG_WRAPPER([vcsn-int-z])
......
......@@ -30,6 +30,8 @@ include vcsn-fmp-tdc/libvcsn-fmp-tdc.mk
include vcsn-tdc/libvcsn-tdc.mk
include vcsn-z-fmp-tdc/libvcsn-z-fmp-tdc.mk
include vcsn-z-tdc/libvcsn-z-tdc.mk
include vcsn-int-fmp-tdc/libvcsn-int-fmp-tdc.mk
include vcsn-int-z-fmp-tdc/libvcsn-int-z-fmp-tdc.mk
maintainer-clean-local:
rm -rf $(top_builddir)/lib/vcsn-b \
......@@ -40,8 +42,10 @@ maintainer-clean-local:
$(top_builddir)/lib/vcsn-z-min \
$(top_builddir)/lib/vcsn-z-max \
$(top_builddir)/lib/vcsn-z-fmp-tdc \
$(top_builddir)/lib/vcsn-int-z-fmp-tdc \
$(top_builddir)/lib/vcsn-z-tdc \
$(top_builddir)/lib/vcsn-fmp-tdc \
$(top_builddir)/lib/vcsn-int-fmp-tdc \
$(top_builddir)/lib/vcsn-tdc
rm -rf $(top_srcdir)/lib/vcsn-b \
$(top_srcdir)/lib/vcsn-int-b \
......@@ -51,7 +55,9 @@ maintainer-clean-local:
$(top_srcdir)/lib/vcsn-z-min \
$(top_srcdir)/lib/vcsn-z-max \
$(top_srcdir)/lib/vcsn-z-fmp-tdc \
$(top_srcdir)/lib/vcsn-int-z-fmp-tdc \
$(top_srcdir)/lib/vcsn-z-tdc \
$(top_srcdir)/lib/vcsn-fmp-tdc \
$(top_srcdir)/lib/vcsn-int-fmp-tdc \
$(top_srcdir)/lib/vcsn-tdc
......@@ -24,8 +24,10 @@ vcsn = Hash[
"vcsn-z-max" => "z_max_plus_automaton",
"vcsn-z-min" => "z_min_plus_automaton",
"vcsn-fmp-tdc" => "fmp_transducer",
"vcsn-int-fmp-tdc" => "int_fmp_transducer",
"vcsn-tdc" => "boolean_transducer",
"vcsn-z-fmp-tdc" => "z_fmp_transducer",
"vcsn-int-z-fmp-tdc" => "int_z_fmp_transducer",
"vcsn-z-tdc" => "z_transducer"
]
......@@ -58,7 +60,8 @@ def create?(type, file)
(
(
"vcsn-fmp-tdc" == type or "vcsn-tdc" == type or
"vcsn-z-fmp-tdc" == type or "vcsn-z-tdc" == type
"vcsn-z-fmp-tdc" == type or "vcsn-z-tdc" == type or
"vcsn-int-fmp-tdc" == type or "vcsn-int-z-fmp-tdc" == type
) and
file !~ /aci_canonical.hh/ and
file !~ /berry_sethi.hh/ and
......@@ -84,12 +87,13 @@ def create?(type, file)
file !~ /standard.hh/ and
file !~ /standard_of.hh/ and
(
("vcsn-fmp-tdc" == type and "vcsn-z-fmp-tdc" == type) or
(
file !~ /complete.hh/ and
file !~ /is_deterministic.hh/ and
file !~ /product.hh/
)
( "vcsn-fmp-tdc" == type or "vcsn-z-fmp-tdc" == type or
"vcsn-int-fmp-tdc" == type or "vcsn-int-z-fmp-tdc" == type ) and
(
file !~ /complete.hh/ and
file !~ /is_deterministic.hh/ and
file !~ /product.hh/
)
)
)
)
......
......@@ -16,8 +16,9 @@ include $(top_srcdir)/vaucanson.mk
AM_CPPFLAGS += $(CXXFLAGS_OPTIMIZE)
AM_LDFLAGS = $(TERMLIBS)
bin_PROGRAMS = vcsn-char-b vcsn-char-z vcsn-char-fmp \
vcsn-int-b vcsn-int-z vcsn-int-fmp
bin_PROGRAMS = vcsn-char-b vcsn-char-z vcsn-char-fmp-b \
vcsn-int-b vcsn-int-z vcsn-int-fmp-b \
vcsn-int-fmp-z vcsn-char-fmp-z
COMMON_SOURCES = commands.hh \
commands_macros.hh \
......@@ -57,21 +58,30 @@ vcsn_char_z_SOURCES = $(COMMON_SOURCES) \
ratexp_commands.hh \
common_automaton_commands.hh \
z_commands.cc
vcsn_char_z_CPPFLAGS = $(AM_CPPFLAGS) -DCONTEXT=z_automaton -DVCSN_USE_LIB
vcsn_char_z_CPPFLAGS = $(AM_CPPFLAGS) -DCONTEXT=z_automaton -DVCSN_USE_LIB \
-DWITH_WEIGHTS
vcsn_char_z_LDADD = $(LDADD) \
$(top_builddir)/lib/libvcsn-z.la \
$(top_builddir)/lib/libkrat_exp.la
vcsn_char_fmp_SOURCES = $(COMMON_SOURCES) fmp_commands.cc
#vcsn_char_fmp_CPPFLAGS = $(AM_CPPFLAGS) -DCONTEXT=fmp_transducer \
# -DWITH_TWO_ALPHABETS -DVCSN_USE_LIB
vcsn_char_fmp_CPPFLAGS = $(AM_CPPFLAGS) \
-DCONTEXT=fmp_transducer -DWITH_TWO_ALPHABETS \
-DIOAUT_CONTEXT=boolean_automaton \
-DRW_CONTEXT=boolean_transducer
vcsn_char_fmp_LDADD = $(LDADD) \
$(top_builddir)/lib/libvcsn-fmp-tdc.la \
$(top_builddir)/lib/libkrat_exp.la
vcsn_char_fmp_b_SOURCES = $(COMMON_SOURCES) fmp_commands.cc
vcsn_char_fmp_b_CPPFLAGS = $(AM_CPPFLAGS) \
-DCONTEXT=fmp_transducer -DWITH_TWO_ALPHABETS \
-DIOAUT_CONTEXT=boolean_automaton \
-DRW_CONTEXT=boolean_transducer
vcsn_char_fmp_b_LDADD = $(LDADD) \
$(top_builddir)/lib/libvcsn-fmp-tdc.la \
$(top_builddir)/lib/libkrat_exp.la
vcsn_char_fmp_z_SOURCES = $(COMMON_SOURCES) fmp_commands.cc
vcsn_char_fmp_z_CPPFLAGS = $(AM_CPPFLAGS) \
-DCONTEXT=z_fmp_transducer -DWITH_TWO_ALPHABETS \
-DIOAUT_CONTEXT=z_automaton \
-DRW_CONTEXT=z_transducer \
-DWITH_WEIGHTS
vcsn_char_fmp_z_LDADD = $(LDADD) \
$(top_builddir)/lib/libvcsn-fmp-tdc.la \
$(top_builddir)/lib/libkrat_exp.la
vcsn_int_b_SOURCES = $(COMMON_SOURCES) \
ratexp_commands.hh \
......@@ -88,18 +98,28 @@ vcsn_int_z_SOURCES = $(COMMON_SOURCES) \
common_automaton_commands.hh \
z_commands.cc
vcsn_int_z_CPPFLAGS = $(AM_CPPFLAGS) -DCONTEXT=int_z_automaton \
-DNO_PREDEF_ALPHABETS -DVCSN_USE_LIB
-DNO_PREDEF_ALPHABETS -DVCSN_USE_LIB \
-DWITH_WEIGHTS
vcsn_int_z_LDADD = $(LDADD) \
$(top_builddir)/lib/libkrat_exp.la \
$(top_builddir)/lib/libvcsn-int-z.la
vcsn_int_fmp_SOURCES = $(COMMON_SOURCES) fmp_commands.cc
vcsn_int_fmp_CPPFLAGS = $(AM_CPPFLAGS) -DCONTEXT=int_fmp_transducer \
-DNO_PREDEF_ALPHABETS -DWITH_TWO_ALPHABETS \
-DIOAUT_CONTEXT=int_boolean_automaton
vcsn_int_fmp_LDADD = $(LDADD) \
$(top_builddir)/lib/libkrat_exp.la
vcsn_int_fmp_b_SOURCES = $(COMMON_SOURCES) fmp_commands.cc
vcsn_int_fmp_b_CPPFLAGS = $(AM_CPPFLAGS) -DCONTEXT=int_fmp_transducer \
-DNO_PREDEF_ALPHABETS -DWITH_TWO_ALPHABETS \
-DIOAUT_CONTEXT=int_boolean_automaton
vcsn_int_fmp_b_LDADD = $(LDADD) \
$(top_builddir)/lib/libkrat_exp.la \
$(top_builddir)/lib/libvcsn-int-fmp-tdc.la
vcsn_int_fmp_z_SOURCES = $(COMMON_SOURCES) fmp_commands.cc
vcsn_int_fmp_z_CPPFLAGS = $(AM_CPPFLAGS) -DCONTEXT=int_z_fmp_transducer \
-DNO_PREDEF_ALPHABETS -DWITH_TWO_ALPHABETS \
-DIOAUT_CONTEXT=int_z_automaton \
-DWITH_WEIGHTS
vcsn_int_fmp_z_LDADD = $(LDADD) \
$(top_builddir)/lib/libkrat_exp.la \
$(top_builddir)/lib/libvcsn-int-z-fmp-tdc.la
## ------ ##
## argp. ##
......
......@@ -78,8 +78,11 @@ namespace edition_commands
/// Exception for cancelling.
struct cancel {};
# ifdef WITH_WEIGHTS
static semiring_elt_value_t get_semiring_elt_value ()
{
echo_ (" With weight: ");
semiring_elt_value_t v;
char first_char = std::cin.get ();
std::cin.unget ();
......@@ -98,6 +101,7 @@ namespace edition_commands
discard_inputs ();
return v;
}
# endif
/// Get an integer from the user.
static int get_int ()
......@@ -199,7 +203,7 @@ namespace edition_commands
throw cancel ();
a.add_series_transition (n_from, n_to,
make_rat_exp (a.structure ().series ().monoid ().alphabet (),
std::string (ratexp), args.tok_rep));
ratexp, args.tok_rep));
# else
// We don't parse ratexps, so we don't use these.
(void) args;
......@@ -222,8 +226,13 @@ namespace edition_commands
// Construct a series from the two components.
semiring_elt_t weight (a.structure().series().semiring());
monoid_elt_t label (a.structure().series().monoid());
# ifdef WITH_WEIGHTS
weight = get_semiring_elt_value();
# else
weight = true;
# endif
monoid_elt_t label (a.structure().series().monoid());
label = monoid_elt_value_t(word1.value(), word2.value());
series_set_elt_t s (a.structure().series());
s.assoc (label, weight);
......@@ -251,15 +260,17 @@ namespace edition_commands
echo_ (" For state: ");
hstate_t n_state = get_state (a);
series_set_elt_t *weight = 0;
if (not type_equal (semiring_elt_value_t, bool) and want_set)
{
echo_ (" With weight: ");
# ifdef WITH_WEIGHTS
if (want_set)
{
semiring_elt_value_t v = get_semiring_elt_value ();
weight = new series_set_elt_t (a.structure ().series ());
weight->assoc (identity_value (SELECT (monoid_t),
SELECT (monoid_elt_value_t)), v);
}
# endif
if (initial)
if (want_set)
if (weight)
......@@ -325,11 +336,17 @@ namespace edition_commands
{
++n_trans;
# ifndef WITH_TWO_ALPHABETS
echo_ ("\n " << n_trans << ": From " << *s << " to "
<< a.dst_of (*h) << " labeled by " << a.series_value_of (*h));
echo_ ("\n " << n_trans << ": From " << *s << " to " << a.dst_of (*h)
<< " labeled by " << a.series_value_of (*h));
# else
# ifndef WITH_WEIGHTS
echo_ ("\n " << n_trans << ": From " << *s << " to " << a.dst_of (*h)
<< " labeled by " << a.word_of (*h));
# else
echo_ ("\n " << n_trans << ": From " << *s << " to " << a.dst_of (*h)
<< " labeled by " << a.word_of (*h)
<< " W: " << a.weight_of (*h));
# endif
# endif
}
}
......@@ -379,6 +396,7 @@ namespace edition_commands
case 10: return true;
}
} catch (const std::logic_error& err) {
// FIXME: this message will never be displayed
warn ("Error: " << err.what ());
std::cin.get ();
std::cin.unget ();
......
......@@ -16,10 +16,12 @@ include $(top_srcdir)/build-aux/check.mk
TESTS = \
vcsn-char-b.test \
vcsn-char-z.test \
vcsn-char-fmp.test \
vcsn-char-fmp-b.test \
vcsn-char-fmp-z.test \
vcsn-int-b.test \
vcsn-int-z.test \
vcsn-int-fmp.test \
vcsn-int-fmp-b.test \
vcsn-int-fmp-z.test \
completeness.test
XFAIL_TESTS = completeness.test
......@@ -45,10 +47,12 @@ EXTRA_DIST = $(TESTS) \
check_SCRIPTS = \
defs \
vcsn-char-b \
vcsn-char-fmp \
vcsn-char-fmp-b \
vcsn-char-fmp-z \
vcsn-char-z \
vcsn-int-b \
vcsn-int-fmp \
vcsn-int-fmp-b \
vcsn-int-fmp-z \
vcsn-int-z
distclean-local:
......
......@@ -17,7 +17,7 @@
set -e
VCSN=vcsn-char-fmp
VCSN=vcsn-char-fmp-b
## ------------------------------------ ##
## Input/output work with transducers. ##
......
#! /bin/sh
# Vaucanson, a generic library for finite state machines.
# Copyright (C) 2008 The Vaucanson Group.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# The complete GNU General Public Licence Notice can be found as the
# `COPYING' file in the root directory.
#
# The Vaucanson Group consists of people listed in the `AUTHORS' file.
. ./defs || exit 1
set -e
VCSN=vcsn-char-fmp-z
......@@ -17,7 +17,7 @@
set -e
VCSN=vcsn-int-fmp
VCSN=vcsn-int-fmp-b
# FIXME: For some reason the output of intersection is bogus. The
# second line will have to be adjusted.
......
#! /bin/sh
# Vaucanson, a generic library for finite state machines.
# Copyright (C) 2008 The Vaucanson Group.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# The complete GNU General Public Licence Notice can be found as the
# `COPYING' file in the root directory.
#
# The Vaucanson Group consists of people listed in the `AUTHORS' file.
. ./defs || exit 1
set -e
VCSN=vcsn-int-fmp-z
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment