https://svn.lrde.epita.fr/svn/oln/trunk/static
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Catch up with the new SCOOP 2 implementation.
* tests/super.cc, tests/vtypes.cc
* tests/vtypes-and-exact.cc: Adjust tests to catch up with the new
stc/scoop.hh.
* stc/Makefile.am (EXTRA_DIST): Add was.scoop.hh.
* tests/Makefile.am
(check_PROGRAMS): Remove multiple-supers and
vtypes-multiple-supers.
(multiple_supers_SOURCES, vtypes_multiple_supers_SOURCES): Remove.
(EXTRA_DIST): New.
Add multiple-supers.cc and vtypes-multiple-supers.cc.
stc/Makefile.am | 3 +
tests/Makefile.am | 7 +--
tests/super.cc | 17 ++++++--
tests/vtypes-and-exact.cc | 89 +++++++++++++++++-----------------------------
tests/vtypes.cc | 44 ++++++++++------------
5 files changed, 71 insertions(+), 89 deletions(-)
Index: tests/vtypes-and-exact.cc
--- tests/vtypes-and-exact.cc (revision 709)
+++ tests/vtypes-and-exact.cc (working copy)
@@ -34,21 +34,16 @@
#include <mlc/int.hh>
#include <stc/any.hh>
+#include <stc/exact.hh>
#include <stc/scoop.hh>
// Helper macros.
-#define my_type_of(FromType, Typedef) \
- typename my_type_of_(FromType, Typedef)
+#define my_type_of_(FromType, Alias) \
+ my::direct_type_of_<FromType, my::typedef_:: Alias##_type>::ret
-#define my_type_of_(FromType, Typedef) \
- stc_type_of_(my, my::category::my_cat, FromType, Typedef)
-
-#define my_direct_type_of(FromExactType, Typedef) \
- typename my_direct_type_of_(FromExactType, Typedef)
-
-#define my_direct_type_of_(FromExactType, Typedef) \
- stc_direct_type_of_(my, my::category::my_cat, FromExactType, Typedef)
+#define my_type_of(FromType, Alias) \
+ typename my_type_of_(FromType, Alias)
// Namespace equipment.
@@ -69,17 +64,6 @@
mlc_decl_typedef(zorg_type);
- /*-----------.
- | Category. |
- `-----------*/
-
- // We only use one category here.
- namespace category
- {
- struct my_cat;
- }
-
-
/*----------------------------------------.
| A<Exact> --|> stc::any__simple<Exact>. |
`----------------------------------------*/
@@ -90,7 +74,7 @@
/// Types associated to my::A.
template <typename Exact>
- struct vtypes_in_category< category::my_cat, A<Exact> >
+ struct vtypes< A<Exact> >
{
// A native type.
typedef int foo_type;
@@ -109,6 +93,8 @@
// Aliases.
+ // META-FIXME: Update comment (stc/scoop.hh as changed since).
+
/* FIXME: Work around a bug that affects both g++ 4.1 and
gcc-snapshot (4.2) from Debian. The versions of the compiler
used at the moment this text was written were:
@@ -123,14 +109,9 @@
assertions ``Ensure stc::is_any_ works properly.'' below (in
main). Using my_direct_type_of (on the exact type) solves
this! */
-#if 0
- typedef my_type_of(self_t, foo) foo_t;
- typedef my_type_of(self_t, bar) bar_t;
- typedef my_type_of(self_t, baz) baz_t;
-#endif
- typedef my_direct_type_of(exact_t, foo) foo_t;
- typedef my_direct_type_of(exact_t, bar) bar_t;
- typedef my_direct_type_of(exact_t, baz) baz_t;
+ typedef my_type_of(exact_t, foo) foo_t;
+ typedef my_type_of(exact_t, bar) bar_t;
+ typedef my_type_of(exact_t, baz) baz_t;
};
@@ -151,7 +132,7 @@
/// Types associated to my::B.
template <typename Exact>
- struct vtypes_in_category< category::my_cat, B<Exact> >
+ struct vtypes< B<Exact> >
{
// (foo is left untouched.)
@@ -165,35 +146,30 @@
/// An extended type associated to my::B.
template <typename Exact>
- struct ext_vtype_in_category<category::my_cat, B<Exact>,
typedef_::yin_type>
+ struct single_vtype< B<Exact>, typedef_::yin_type >
{
typedef unsigned long ret;
};
template <typename Exact>
- struct B : public stc_get_supers(B<Exact>)
+ struct B : public A<Exact>
{
typedef B<Exact> self_t;
typedef Exact exact_t;
// Aliases.
+ // META-FIXME: Update comment (stc/scoop.hh as changed since).
+
/* FIXME: Same as above; using my_type_of (i.e., using
stc_to_exact) breaks the assertions ``Ensure stc::is_any_ works
properly.'' below (in main). Using my_direct_type_of (on the
exact type) solves this! */
-#if 0
- typedef my_type_of(self_t, foo) foo_t;
- typedef my_type_of(self_t, bar) bar_t;
- typedef my_type_of(self_t, baz) baz_t;
- typedef my_type_of(self_t, quux) quux_t;
- typedef my_type_of(self_t, yin) yin_t;
-#endif
- typedef my_direct_type_of(exact_t, foo) foo_t;
- typedef my_direct_type_of(exact_t, bar) bar_t;
- typedef my_direct_type_of(exact_t, baz) baz_t;
- typedef my_direct_type_of(exact_t, quux) quux_t;
- typedef my_direct_type_of(exact_t, yin) yin_t;
+ typedef my_type_of(exact_t, foo) foo_t;
+ typedef my_type_of(exact_t, bar) bar_t;
+ typedef my_type_of(exact_t, baz) baz_t;
+ typedef my_type_of(exact_t, quux) quux_t;
+ typedef my_type_of(exact_t, yin) yin_t;
};
@@ -205,35 +181,36 @@
struct C;
// Super type.
- stc_set_super(C, B<C>);
+ template <>
+ struct set_super_type<C>
+ {
+ typedef B<C> ret;
+ };
/// Types associated to my::C.
template <>
- struct vtypes_in_category<category::my_cat, C>
+ struct vtypes<C>
{
// A type defined only here (and not in the super class).
typedef double zorg_type;
};
- struct C : public stc_get_supers(C)
+ struct C : public B<C>
{
typedef C self_t;
typedef self_t exact_t;
// Aliases.
+ // META-FIXME: Update comment (stc/scoop.hh as changed since).
+
/* FIXME: Same as above; using my_type_of_ (i.e., using
stc_to_exact) breaks the assertions ``Ensure stc::is_any_ works
properly.'' below (in main). Using my_direct_type_of_ (on the
exact type) solves this! */
-#if 0
- typedef my_type_of_(self_t, foo) foo_t;
- typedef my_type_of_(self_t, quux) quux_t;
- typedef my_type_of_(self_t, zorg) zorg_t;
-#endif
- typedef my_direct_type_of_(exact_t, foo) foo_t;
- typedef my_direct_type_of_(exact_t, quux) quux_t;
- typedef my_direct_type_of_(exact_t, zorg) zorg_t;
+ typedef my_type_of_(exact_t, foo) foo_t;
+ typedef my_type_of_(exact_t, quux) quux_t;
+ typedef my_type_of_(exact_t, zorg) zorg_t;
};
} // end of namespace my
Index: tests/super.cc
--- tests/super.cc (revision 709)
+++ tests/super.cc (working copy)
@@ -56,10 +56,14 @@
// Forward declaration.
struct B;
- // Warning, this sugar might be removed in the future.
- stc_set_super(B, A);
+ // Set super type.
+ template<>
+ struct set_super_type<B>
+ {
+ typedef A ret;
+ };
- struct B : public stc_get_supers(B)
+ struct B : public A
{
};
@@ -76,9 +80,12 @@
simple test, but it doesn't matter: we are only checking the
super relationship here. */
- // Warning, this sugar might be removed in the future.
/// Link to B (``pseudo'' inheritance).
- stc_set_pseudosuper(C, B);
+ template<>
+ struct set_pseudosuper_type<C>
+ {
+ typedef B ret;
+ };
struct C // no inheritance
{
Index: tests/Makefile.am
--- tests/Makefile.am (revision 709)
+++ tests/Makefile.am (working copy)
@@ -17,11 +17,9 @@
entry \
exact \
find_exact \
- multiple-supers \
super \
vtypes \
vtypes-and-exact \
- vtypes-multiple-supers \
\
tour
@@ -29,12 +27,13 @@
entry_SOURCES = entry.cc
exact_SOURCES = exact.cc
find_exact_SOURCES = find_exact.cc
-multiple_supers_SOURCES = multiple-supers.cc
super_SOURCES = super.cc
vtypes_SOURCES = vtypes.cc
vtypes_and_exact_SOURCES = vtypes-and-exact.cc
-vtypes_multiple_supers_SOURCES = vtypes-multiple-supers.cc
tour_SOURCES = tour.cc
+# Old tests.
+EXTRA_DIST = multiple-supers.cc vtypes-multiple-supers.cc
+
TESTS = $(check_PROGRAMS)
Index: tests/vtypes.cc
--- tests/vtypes.cc (revision 709)
+++ tests/vtypes.cc (working copy)
@@ -36,11 +36,11 @@
// Helper macros.
-#define my_type_of(FromType, Typedef) \
- typename my_type_of_(FromType, Typedef)
+#define my_type_of_(FromType, Alias) \
+ my::direct_type_of_<FromType, my::typedef_:: Alias##_type>::ret
-#define my_type_of_(FromType, Typedef) \
- stc_type_of_(my, my::category::my_cat, FromType, Typedef)
+#define my_type_of(FromType, Alias) \
+ typename my_type_of_(FromType, Alias)
// Namespace equipment.
@@ -61,17 +61,6 @@
mlc_decl_typedef(zorg_type);
- /*-----------.
- | Category. |
- `-----------*/
-
- // We only use one category here.
- namespace category
- {
- struct my_cat;
- }
-
-
/*----.
| A. |
`----*/
@@ -81,7 +70,7 @@
/// Types associated to my::A.
template <>
- struct vtypes_in_category<category::my_cat, my::A>
+ struct vtypes<my::A>
{
// A native type.
typedef int foo_type;
@@ -109,12 +98,16 @@
// Forward declaration.
struct B;
- // Warning, this sugar might be removed in the future.
- stc_set_super(B, A);
+ // Set super type.
+ template<>
+ struct set_super_type<B>
+ {
+ typedef A ret;
+ };
/// Types associated to my::B.
template <>
- struct vtypes_in_category<category::my_cat, B>
+ struct vtypes<B>
{
// (foo is left untouched.)
@@ -128,12 +121,12 @@
/// An extended type associated to my::B.
template <>
- struct ext_vtype_in_category<category::my_cat, B, typedef_::yin_type>
+ struct single_vtype<B, typedef_::yin_type>
{
typedef unsigned long ret;
};
- struct B : public stc_get_supers(B)
+ struct B : public A
{
// Aliases.
typedef my_type_of_(B, foo) foo_type;
@@ -155,13 +148,16 @@
// from B's vtypes (see the specialization
// types<category::my_cat, Z>).
- // Warning, this sugar might be removed in the future.
/// Link to B (``pseudo'' inheritance).
- stc_set_pseudosuper(Z, B);
+ template<>
+ struct set_super_type<Z>
+ {
+ typedef B ret;
+ };
/// Types associated to my::Z.
template <>
- struct vtypes_in_category<category::my_cat, Z>
+ struct vtypes<Z>
{
// A type defined only here (and not in the super class).
typedef double zorg_type;
Index: stc/Makefile.am
--- stc/Makefile.am (revision 709)
+++ stc/Makefile.am (working copy)
@@ -10,3 +10,6 @@
valist_aggregator.hh \
\
internal/extract_vtype_from_list.hh
+
+# Old code.
+EXTRA_DIST = was.scoop.hh