Commit 4d84dc0c authored by Roland Levillain's avatar Roland Levillain
Browse files

Rename stc/scoop2.hh as stc/scoop-alt.hh.

	Encapsulate the contents of SCOOPED_NAMESPACE in
	stc_scoop_equipment_for_namespace.

	* stc/scoop2.hh: Rename as...
	* stc/scoop-alt.hh: ...this.
	Adjust header guards.
	(ERROR::IN_find__VIRTUAL_TYPE_IS_ABSTRACT)
	(ERROR::IN_find_local__VIRTUAL_TYPE_MULTIPLY_DEFINED)
	(ERROR::IN_merge2__FINAL_VIRTUAL_TYPE_REDEFINED_ABSTRACT)
	(ERROR::IN_merge2__FINAL_VIRTUAL_TYPE_REDEFINED_FINAL)
	(ERROR::IN_merge2__FINAL_VIRTUAL_TYPE_REDEFINED)
	(ERROR::IN_merge2__VIRTUAL_TYPE_REDEFINED_ABSTRACT)
	(ERROR::IN_merge3__FINAL_VIRTUAL_TYPE_REDEFINED_ABSTRACT)
	(ERROR::IN_merge3__VIRTUAL_TYPE_REDEFINED_ABSTRACT)
	(ERROR::IN_merge3__LOCAL_DECLARATION_OF_NOT_DELEGATED_AND_ABSTRACT)
	(ERROR::IN_merge3__FINAL_VIRTUAL_TYPE_REDEFINED_FINAL)
	(ERROR::IN_merge3__FINAL_VIRTUAL_TYPE_REDEFINED): Rename as...
	(ERROR::IN_find_VIRTUAL_TYPE_IS_ABSTRACT)
	(ERROR::IN_find_local_VIRTUAL_TYPE_MULTIPLY_DEFINED)
	(ERROR::IN_merge2_FINAL_VIRTUAL_TYPE_REDEFINED_ABSTRACT)
	(ERROR::IN_merge2_FINAL_VIRTUAL_TYPE_REDEFINED_FINAL)
	(ERROR::IN_merge2_FINAL_VIRTUAL_TYPE_REDEFINED)
	(ERROR::IN_merge2_VIRTUAL_TYPE_REDEFINED_ABSTRACT)
	(ERROR::IN_merge3_FINAL_VIRTUAL_TYPE_REDEFINED_ABSTRACT)
	(ERROR::IN_merge3_VIRTUAL_TYPE_REDEFINED_ABSTRACT)
	(ERROR::IN_merge3_LOCAL_DECLARATION_OF_NOT_DELEGATED_AND_ABSTRACT)
	(ERROR::IN_merge3_FINAL_VIRTUAL_TYPE_REDEFINED_FINAL)
	(ERROR::IN_merge3_FINAL_VIRTUAL_TYPE_REDEFINED): ...these.
	(SCOOPED_NAMESPACE): Remove macro.
	(stc_scoop_equipment_for_namespace): New macro.
	Encapsulate the contents of SCOOPED_NAMESPACE within this macro.
	(stc_match_pair_0p_with, stc_match_pair_1p_with)
	(stc_match_pair_2p_with, stc_match_pair_1p_with_error)
	(stc_match_pair_2p_with_error)
	(stc_match_triple_0p_with, stc_match_triple_1p_with)
	(stc_match_triple_2p_with, stc_match_triple_3p_with)
	(stc_match_triple_2p_with_error, stc_match_triple_3p_with_error):
	Move and rename these macros as..
	* stc/internal/match-with.hh (stc_internal_match_pair_0p_with)
	(stc_internal_match_pair_1p_with, stc_internal_match_pair_2p_with)
	(stc_internal_match_pair_1p_with_error)
	(stc_internal_match_pair_2p_with_error)
	(stc_internal_match_triple_0p_with)
	(stc_internal_match_triple_1p_with)
	(stc_internal_match_triple_2p_with)
	(stc_internal_match_triple_3p_with)
	(stc_internal_match_triple_2p_with_error)
	(stc_internal_match_triple_3p_with_error): ...these (new file).
	* stc/Makefile (nobase_stc_HEADERS): Remove scoop2.hh.
	Add scoop-alt.hh and internal/match-with.hh.

	* tests/scoop2.cc: Rename as...
	* tests/scoop-alt.cc: ...this.
	Adjust.
	(stc_scoop_equipment_for_namespace): Invoke it.
	* tests/super.cc (my::set_pseudosuper_type<C>): Remove.
	(my::vtypes<C>::delegatee_type): New.
	* tests/Makefile.am (nobase_stc_HEADERS): Add
	internal/match-with.hh.
	(scoop2_SOURCES): Remove.
	(scoop_alt_SOURCES): New.


git-svn-id: https://svn.lrde.epita.fr/svn/oln/trunk@726 4aad255d-cdde-0310-9447-f3009e2ae8c0
parent eeb74355
2007-01-30 Roland Levillain <roland@lrde.epita.fr>
Rename stc/scoop2.hh as stc/scoop-alt.hh.
Encapsulate the contents of SCOOPED_NAMESPACE in
stc_scoop_equipment_for_namespace.
* stc/scoop2.hh: Rename as...
* stc/scoop-alt.hh: ...this.
Adjust header guards.
(ERROR::IN_find__VIRTUAL_TYPE_IS_ABSTRACT)
(ERROR::IN_find_local__VIRTUAL_TYPE_MULTIPLY_DEFINED)
(ERROR::IN_merge2__FINAL_VIRTUAL_TYPE_REDEFINED_ABSTRACT)
(ERROR::IN_merge2__FINAL_VIRTUAL_TYPE_REDEFINED_FINAL)
(ERROR::IN_merge2__FINAL_VIRTUAL_TYPE_REDEFINED)
(ERROR::IN_merge2__VIRTUAL_TYPE_REDEFINED_ABSTRACT)
(ERROR::IN_merge3__FINAL_VIRTUAL_TYPE_REDEFINED_ABSTRACT)
(ERROR::IN_merge3__VIRTUAL_TYPE_REDEFINED_ABSTRACT)
(ERROR::IN_merge3__LOCAL_DECLARATION_OF_NOT_DELEGATED_AND_ABSTRACT)
(ERROR::IN_merge3__FINAL_VIRTUAL_TYPE_REDEFINED_FINAL)
(ERROR::IN_merge3__FINAL_VIRTUAL_TYPE_REDEFINED): Rename as...
(ERROR::IN_find_VIRTUAL_TYPE_IS_ABSTRACT)
(ERROR::IN_find_local_VIRTUAL_TYPE_MULTIPLY_DEFINED)
(ERROR::IN_merge2_FINAL_VIRTUAL_TYPE_REDEFINED_ABSTRACT)
(ERROR::IN_merge2_FINAL_VIRTUAL_TYPE_REDEFINED_FINAL)
(ERROR::IN_merge2_FINAL_VIRTUAL_TYPE_REDEFINED)
(ERROR::IN_merge2_VIRTUAL_TYPE_REDEFINED_ABSTRACT)
(ERROR::IN_merge3_FINAL_VIRTUAL_TYPE_REDEFINED_ABSTRACT)
(ERROR::IN_merge3_VIRTUAL_TYPE_REDEFINED_ABSTRACT)
(ERROR::IN_merge3_LOCAL_DECLARATION_OF_NOT_DELEGATED_AND_ABSTRACT)
(ERROR::IN_merge3_FINAL_VIRTUAL_TYPE_REDEFINED_FINAL)
(ERROR::IN_merge3_FINAL_VIRTUAL_TYPE_REDEFINED): ...these.
(SCOOPED_NAMESPACE): Remove macro.
(stc_scoop_equipment_for_namespace): New macro.
Encapsulate the contents of SCOOPED_NAMESPACE within this macro.
(stc_match_pair_0p_with, stc_match_pair_1p_with)
(stc_match_pair_2p_with, stc_match_pair_1p_with_error)
(stc_match_pair_2p_with_error)
(stc_match_triple_0p_with, stc_match_triple_1p_with)
(stc_match_triple_2p_with, stc_match_triple_3p_with)
(stc_match_triple_2p_with_error, stc_match_triple_3p_with_error):
Move and rename these macros as..
* stc/internal/match-with.hh (stc_internal_match_pair_0p_with)
(stc_internal_match_pair_1p_with, stc_internal_match_pair_2p_with)
(stc_internal_match_pair_1p_with_error)
(stc_internal_match_pair_2p_with_error)
(stc_internal_match_triple_0p_with)
(stc_internal_match_triple_1p_with)
(stc_internal_match_triple_2p_with)
(stc_internal_match_triple_3p_with)
(stc_internal_match_triple_2p_with_error)
(stc_internal_match_triple_3p_with_error): ...these (new file).
* stc/Makefile (nobase_stc_HEADERS): Remove scoop2.hh.
Add scoop-alt.hh and internal/match-with.hh.
* tests/scoop2.cc: Rename as...
* tests/scoop-alt.cc: ...this.
Adjust.
(stc_scoop_equipment_for_namespace): Invoke it.
* tests/super.cc (my::set_pseudosuper_type<C>): Remove.
(my::vtypes<C>::delegatee_type): New.
* tests/Makefile.am (nobase_stc_HEADERS): Add
internal/match-with.hh.
(scoop2_SOURCES): Remove.
(scoop_alt_SOURCES): New.
2007-01-30 Thierry GERAUD <theo@tegucigalpa.lrde.epita.fr> 2007-01-30 Thierry GERAUD <theo@tegucigalpa.lrde.epita.fr>
Add mini-std. Add mini-std.
......
...@@ -7,11 +7,11 @@ nobase_stc_HEADERS = \ ...@@ -7,11 +7,11 @@ nobase_stc_HEADERS = \
exact.hh \ exact.hh \
find_exact.hh \ find_exact.hh \
scoop.hh \ scoop.hh \
scoop-alt.hh \
valist_aggregator.hh \ valist_aggregator.hh \
\ \
internal/extract_vtype_from_list.hh \ internal/extract_vtype_from_list.hh \
\ internal/match-with.hh
scoop2.hh
# Old code. # Old code.
EXTRA_DIST = was.scoop.hh EXTRA_DIST = was.scoop.hh
// Copyright (C) 2005, 2006, 2007 EPITA Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License version 2 as published by the
// Free Software Foundation.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this library; see the file COPYING. If not, write to
// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
// Boston, MA 02111-1307, USA.
//
// As a special exception, you may use this file as part of a free
// software library without restriction. Specifically, if other files
// instantiate templates or use macros or inline functions from this
// file, or you compile this file and link it with other files to
// produce an executable, this file does not by itself cause the
// resulting executable to be covered by the GNU General Public
// License. This exception does not however invalidate any other
// reasons why the executable file might be covered by the GNU General
// Public License.
/* \file stc/match-with.hh
\brief Internal helpers for stc/scoop-alt.hh.
This file contains helpers that mimic a ``match-with'' (pattern
matching) construct from many functional languages. */
#ifndef STC_INTERNAL_MATCH_WITH_HH
# define STC_INTERNAL_MATCH_WITH_HH
/*-----------------.
| merge2 helpers. |
`-----------------*/
/* Shortcuts macros. */
#define stc_internal_match_pair_0p_with(Local, Super, Res) \
template <> \
struct match_with< Local, Super > \
{ \
typedef Res ret; \
}
#define stc_internal_match_pair_1p_with(T1, Local, Super, Res) \
template < typename T1 > \
struct match_with< Local, Super > \
{ \
typedef Res ret; \
}
#define stc_internal_match_pair_2p_with(T1, T2, Local, Super, Res) \
template < typename T1, typename T2 > \
struct match_with< Local, Super > \
{ \
typedef Res ret; \
}
/* Erroneous cases. */
#define stc_internal_match_pair_1p_with_error(T1, Local, Super, Msg) \
template < typename T1 > \
struct match_with< Local, Super > : \
mlc::abort_< T1, Msg > \
{ \
}
#define stc_internal_match_pair_2p_with_error(T1, T2, Local, Super, Msg) \
template < typename T1, typename T2 > \
struct match_with< Local, Super > : \
mlc::abort_< T2, Msg > \
{ \
}
/*-----------------.
| merge3 helpers. |
`-----------------*/
/* Shortcuts macros. */
#define stc_internal_match_triple_0p_with(Local, Super, Deleg, Res) \
template <> \
struct match_with< Local, Super, Deleg > \
{ \
typedef Res ret; \
}
#define stc_internal_match_triple_1p_with(T1, Local, Super, Deleg, Res) \
template < typename T1 > \
struct match_with< Local, Super, Deleg > \
{ \
typedef Res ret; \
}
#define stc_internal_match_triple_2p_with(T1, T2, Local, Super, Deleg, Res) \
template < typename T1, typename T2 > \
struct match_with< Local, Super, Deleg > \
{ \
typedef Res ret; \
}
#define stc_internal_match_triple_3p_with(T1, T2, T3, Local, Super, Deleg, Res) \
template < typename T1, typename T2, typename T3 > \
struct match_with< Local, Super, Deleg > \
{ \
typedef Res ret; \
}
/* Erroneous cases. */
#define stc_internal_match_triple_2p_with_error(T1, T2, Local, Super, Deleg, Msg) \
template < typename T1, typename T2 > \
struct match_with< Local, Super, Deleg > : \
mlc::abort_< T2, Msg > \
{ \
}
#define stc_internal_match_triple_3p_with_error(T1, T2, T3, Local, Super, Deleg, Msg) \
template < typename T1, typename T2, typename T3 > \
struct match_with< Local, Super, Deleg > : \
mlc::abort_< T3, Msg > \
{ \
}
#endif // ! STC_INTERNAL_MATCH_WITH_HH
This diff is collapsed.
This diff is collapsed.
...@@ -23,7 +23,7 @@ check_PROGRAMS = \ ...@@ -23,7 +23,7 @@ check_PROGRAMS = \
\ \
tour \ tour \
\ \
scoop2 scoop-alt
any_SOURCES = any.cc any_SOURCES = any.cc
...@@ -36,7 +36,7 @@ vtypes_and_exact_SOURCES = vtypes-and-exact.cc ...@@ -36,7 +36,7 @@ vtypes_and_exact_SOURCES = vtypes-and-exact.cc
tour_SOURCES = tour.cc tour_SOURCES = tour.cc
scoop2_SOURCES = scoop2.cc scoop_alt_SOURCES = scoop-alt.cc
# Old tests. # Old tests.
EXTRA_DIST = multiple-supers.cc vtypes-multiple-supers.cc EXTRA_DIST = multiple-supers.cc vtypes-multiple-supers.cc
......
...@@ -35,14 +35,11 @@ ...@@ -35,14 +35,11 @@
#include <mlc/cmp.hh> #include <mlc/cmp.hh>
#include <mlc/assert.hh> #include <mlc/assert.hh>
#include <stc/scoop2.hh> #include <stc/scoop-alt.hh>
/* FIXME: To be enabled later, when the contents of stc/scoop2.hh is
enclosed in a macro. */
#if 0
// Namespace equipment. // Namespace equipment.
stc_scoop_equipment_for_namespace(my); stc_scoop_equipment_for_namespace(my);
#endif
// FIXME: Check single_vtype, too. // FIXME: Check single_vtype, too.
......
...@@ -80,11 +80,11 @@ namespace my ...@@ -80,11 +80,11 @@ namespace my
simple test, but it doesn't matter: we are only checking the simple test, but it doesn't matter: we are only checking the
super relationship here. */ super relationship here. */
/// Link to B (``pseudo'' inheritance). /// Delegation to B (used to be called ``pseudo'' inheritance).
template<> template<>
struct set_pseudosuper_type<C> struct vtypes<C>
{ {
typedef B ret; typedef B delegatee_type;
}; };
struct C // no inheritance struct C // no inheritance
......
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