Commit 95ef2220 authored by Thierry Geraud's avatar Thierry Geraud
Browse files

2007-02-02 Thierry GERAUD <theo@tegucigalpa.lrde.epita.fr>

	Clean stc/doc/tiny.

	* doc/tiny/more_scoop_2/undefs.hh: Rename as...
	* doc/tiny/local/undefs.hh: ...this.
	* doc/tiny/a_la_scoop_1/local_scoop.hh: Rename as...
	* doc/tiny/a_la_scoop_1/scoopy.hh: ...this.
	* doc/tiny/more_scoop_2/local_scoop.hh: Rename as...
	* doc/tiny/local/scoop.hh: ...this.
	(stc::true_, stc::false_): New.
	(stc_prop): Update.
	(stc_decl_associated_type): New.
	* doc/tiny/a_la_scoop_2/local_scoop.hh: Remove.
	* doc/tiny/a_la_scoop_1/main.cc,
	(Current, Super): Rename as...
	(current, super): ...this to be coherent with SCOOP 2.
	* doc/tiny/a_la_scoop_1/scoopy.hh,
	Likewise.
	* doc/tiny/a_la_scoop_1/desugar.cc,
	Likewise.
	* doc/tiny/a_la_scoop_2/main.cc,
	* doc/tiny/a_la_scoop_2/desugar.cc,
	* doc/tiny/more_scoop_2/main.cc,
	* doc/tiny/cpp_with_virtual_types/main.cc,
	* doc/tiny/design/main.cc,
	(category): New type in array_iterator.
	* doc/tiny/cpp_with_concepts/main.cc,
	* doc/tiny/classical/main.cc,
	* doc/tiny/generic_programming/main.cc: Update and
	add copyright header.



git-svn-id: https://svn.lrde.epita.fr/svn/oln/trunk@735 4aad255d-cdde-0310-9447-f3009e2ae8c0
parent 26705f9c
2007-02-02 Thierry GERAUD <theo@tegucigalpa.lrde.epita.fr>
Clean stc/doc/tiny.
* doc/tiny/more_scoop_2/undefs.hh: Rename as...
* doc/tiny/local/undefs.hh: ...this.
* doc/tiny/a_la_scoop_1/local_scoop.hh: Rename as...
* doc/tiny/a_la_scoop_1/scoopy.hh: ...this.
* doc/tiny/more_scoop_2/local_scoop.hh: Rename as...
* doc/tiny/local/scoop.hh: ...this.
(stc::true_, stc::false_): New.
(stc_prop): Update.
(stc_decl_associated_type): New.
* doc/tiny/a_la_scoop_2/local_scoop.hh: Remove.
* doc/tiny/a_la_scoop_1/main.cc,
(Current, Super): Rename as...
(current, super): ...this to be coherent with SCOOP 2.
* doc/tiny/a_la_scoop_1/scoopy.hh,
Likewise.
* doc/tiny/a_la_scoop_1/desugar.cc,
Likewise.
* doc/tiny/a_la_scoop_2/main.cc,
* doc/tiny/a_la_scoop_2/desugar.cc,
* doc/tiny/more_scoop_2/main.cc,
* doc/tiny/cpp_with_virtual_types/main.cc,
* doc/tiny/design/main.cc,
(category): New type in array_iterator.
* doc/tiny/cpp_with_concepts/main.cc,
* doc/tiny/classical/main.cc,
* doc/tiny/generic_programming/main.cc: Update and
add copyright header.
2007-02-02 Roland Levillain <roland@lrde.epita.fr>
Automate the compilation of mini-oln.
......
#include "local_scoop.hh"
// Copyright (C) 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 doc/tiny/a_la_scoop_1/desugar.cc
\brief Tiny sample use of SCOOP 1 without sugar. */
#include "scoopy.hh"
stc_equip_namespace(abc);
......@@ -24,7 +56,7 @@ namespace abc
class Iterator : public Any<Exact>
{
public:
stc_typename(value);
typedef typename vtypes<Exact>::value value;
void next() { this->exact().impl_next(); }
bool is_valid() const { return this->exact().impl_is_valid(); }
void set(const value& v) { this->exact().impl_set(v); }
......@@ -44,10 +76,10 @@ namespace abc
template <typename T>
class array_iterator : public Iterator< array_iterator<T> >
{
typedef Iterator< array_iterator<T> > Super;
typedef Iterator< array_iterator<T> > super;
public:
stc_using(value);
typedef typename super::value value;
void impl_next() { i_ = i_ + 1; }
bool impl_is_valid() const { return i_ >= 0 and i_ < n_; }
void impl_set(const value& v) { v_ = v; }
......
namespace stc
{
class abstract;
template <typename Exact>
class any
{
public:
Exact& exact() { return *(Exact*)(void*)this; }
const Exact& exact() const { return *(const Exact*)(const void*)this; }
};
}
#define stc_typename(Type) typedef typename vtypes<Exact>::Type Type
#define stc_using(Type) typedef typename Super::Type Type
#define stc_equip_namespace(Namespace) \
\
namespace Namespace \
{ \
template <typename T> struct vtypes; \
\
/* Any. */ \
\
template <typename Exact> class Any; \
\
template <typename Exact> \
struct vtypes< Any<Exact> > \
{ \
typedef Exact exact; \
}; \
\
template <typename Exact> \
class Any : public stc::any<Exact> \
{ \
}; \
\
} \
\
struct end_with_semicolumn
#include "local_scoop.hh"
// Copyright (C) 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 doc/tiny/a_la_scoop_1/main.cc
\brief Tiny sample use of SCOOP 1. */
#include "scoopy.hh"
stc_equip_namespace(abc);
......@@ -12,19 +44,19 @@ namespace abc
// Iterator
# define Current Iterator<Exact>
# define Super Any<Exact>
# define current Iterator<Exact>
# define super Any<Exact>
template <typename Exact> class Iterator;
template <typename Exact>
struct vtypes< Current > : vtypes< Super >
struct vtypes< current > : vtypes< super >
{
typedef stc::abstract value;
};
template <typename Exact>
class Iterator : public Super
class Iterator : public super
{
public:
stc_typename(value);
......@@ -33,25 +65,25 @@ namespace abc
void set(const value& v) { this->exact().impl_set(v); }
};
#undef Super
#undef Current
#undef super
#undef current
// array_iterator
# define Current array_iterator<T>
# define Super Iterator<Current>
# define current array_iterator<T>
# define super Iterator< current >
template <typename T> class array_iterator;
template <typename T>
struct vtypes< Current > : vtypes< Super >
struct vtypes< current > : vtypes< super >
{
typedef T value;
};
template <typename T>
class array_iterator : public Super
class array_iterator : public super
{
public:
......@@ -66,8 +98,8 @@ namespace abc
value v_;
};
#undef Super
#undef Current
#undef super
#undef current
......
// Copyright (C) 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 doc/tiny/a_la_scoop_1/scoopy.hh
\brief Mini-equipment for SCOOP 1. */
#ifndef STC_DOC_TINY_A_LA_SCOOP_1_SCOOPY_HH
# define STC_DOC_TINY_A_LA_SCOOP_1_SCOOPY_HH
namespace stc
{
class abstract;
template <typename Exact>
class any
{
public:
Exact& exact() { return *(Exact*)(void*)this; }
const Exact& exact() const { return *(const Exact*)(const void*)this; }
};
}
# define stc_typename(Type) typedef typename vtypes<Exact>::Type Type
# define stc_using(Type) typedef typename super::Type Type
# define stc_equip_namespace(Namespace) \
\
namespace Namespace \
{ \
template <typename T> struct vtypes; \
\
/* Any. */ \
\
template <typename Exact> class Any; \
\
template <typename Exact> \
struct vtypes< Any<Exact> > \
{ \
typedef Exact exact; \
}; \
\
template <typename Exact> \
class Any : public stc::any<Exact> \
{ \
}; \
\
} \
\
struct end_with_semicolumn
#endif // ! STC_DOC_TINY_A_LA_SCOOP_1_SCOOPY_HH
#include "local_scoop.hh"
// Copyright (C) 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 doc/tiny/a_la_scoop_2/desugar.cc
\brief Tiny sample use of SCOOP 2 without sugar. */
#include "../local/scoop.hh"
stc_equip_namespace(abc);
......@@ -10,7 +42,7 @@ namespace abc
{
// List of associated types.
mlc_decl_typedef(value);
stc_decl_associated_type(value);
// Iterator
......
This diff is collapsed.
#include "local_scoop.hh"
// Copyright (C) 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 doc/tiny/a_la_scoop_2/main.cc
\brief Tiny sample use of SCOOP 2. */
#include "../local/scoop.hh"
stc_equip_namespace(abc);
......@@ -10,7 +42,7 @@ namespace abc
{
// List of associated types.
mlc_decl_typedef(value);
stc_decl_associated_type(value);
// Iterator
......@@ -20,7 +52,6 @@ namespace abc
public automatic::impl<Iterator, Exact>
{
stc_typename(value);
void next() { this->exact().impl_next(); }
bool is_valid() const { return this->exact().impl_is_valid(); }
void set(const value& v) { this->exact().impl_set(v); }
......@@ -53,23 +84,17 @@ namespace abc
public:
stc_using(value);
// Impl.
void impl_next() { i_ = i_ + 1; }
bool impl_is_valid() const { return i_ >= 0 and i_ < n_; }
void impl_set(const value& v) { v_ = v; }
// Ctor.
array_iterator(int n) : i_(0), n_(n) {}
protected:
int i_, n_;
value v_;
};
# include "undefs.hh"
# include "../local/undefs.hh"
......
#undef current
#undef super
#undef templ
#undef classname
// Copyright (C) 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 doc/tiny/classical/main.cc
\brief Tiny sample use in classical OOP. */
namespace abc
{
......
// Copyright (C) 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 doc/tiny/cpp_with_concepts/main.cc
\brief Tiny sample use with C++Ox; it should compile with ConceptGCC. */
#include <iostream>
......
// Copyright (C) 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 doc/tiny/cpp_with_virtual_types/main.cc
\brief Tiny sample use in pseudo-C++ (C++ with virtual types). */
namespace abc
{
......
// Copyright (C) 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 doc/tiny/design/main.cc
\brief Tiny sample use in a pseudo-language. */
namespace abc
{
......@@ -14,6 +45,8 @@ namespace abc
array_iterator : [T: type] -> class =
{
category : type = Iterator;
value : type = T
next : () -> void = { i_ := i_ + 1 }
is_valid : const () -> bool = { return i_ >= 0 and i_ < n_ }
......
// Copyright (C) 2007 EPITA Research and Development Laboratory.
//
// This file is part of the Olena Library. This library is free