Commit e435b9ba authored by Guillaume Lazzara's avatar Guillaume Lazzara
Browse files

Remove deprecated trace system.

	* mln/trace/all.hh,
	* mln/trace/entering.hh,
	* mln/trace/essential.hh,
	* mln/trace/exiting.hh,
	* mln/trace/quiet.hh,
	* mln/trace/resume.hh,
	* mln/trace/stop.hh,
	* mln/trace/warning.hh: Remove.
parent d48b8a4a
2013-03-18 Guillaume Lazzara <z@lrde.epita.fr>
Remove deprecated trace system.
* mln/trace/all.hh,
* mln/trace/entering.hh,
* mln/trace/essential.hh,
* mln/trace/exiting.hh,
* mln/trace/quiet.hh,
* mln/trace/resume.hh,
* mln/trace/stop.hh,
* mln/trace/warning.hh: Remove.
2013-03-18 Guillaume Lazzara <z@lrde.epita.fr>
 
* tests/unit_test/unit-tests.mk: Regen.
// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of Olena.
//
// Olena 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, version 2 of the License.
//
// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
//
// As a special exception, you may use this file as part of a free
// software project 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.
#ifndef MLN_TRACE_ALL_HH
# define MLN_TRACE_ALL_HH
/*! \file
*
* \brief File that includes all trace-related routines.
*/
namespace mln
{
/// Namespace of routines related to the trace mechanism.
namespace trace {}
} // end of namespace mln
# include <mln/trace/quiet.hh>
# include <mln/trace/entering.hh>
# include <mln/trace/exiting.hh>
# include <mln/trace/stop.hh>
# include <mln/trace/resume.hh>
# include <mln/trace/warning.hh>
#endif // ! MLN_TRACE_ALL_HH
// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of Olena.
//
// Olena 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, version 2 of the License.
//
// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
//
// As a special exception, you may use this file as part of a free
// software project 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.
#ifndef MLN_TRACE_ENTERING_HH
# define MLN_TRACE_ENTERING_HH
/// \file
///
/// Definition of the trace entering procedure.
# include <string>
# include <iostream>
# include <stack>
# include <ctime>
# include <mln/trace/quiet.hh>
namespace mln
{
namespace trace
{
void entering(const std::string& scope);
extern std::stack<std::clock_t> start_times;
extern std::stack<std::string> scopes; // For testing purpose
// (entering/exiting scope matching).
# ifndef MLN_INCLUDE_ONLY
# ifndef MLN_WO_GLOBAL_VARS
std::stack<std::clock_t> start_times;
std::stack<std::string> scopes;
# endif // !MLN_WO_GLOBAL_VARS
inline
void entering(const std::string& scope)
{
if (quiet)
return;
start_times.push(std::clock());
scopes.push(scope);
if ((tab != 0) && (internal::max_tab == tab))
std::cout << std::endl;
for (unsigned i = 0; i < tab; ++i)
std::cout << " ";
std::cout << scope << " {";
internal::max_tab = ++tab;
}
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::trace
} // end of namespace mln
#endif // ! MLN_TRACE_ENTERING_HH
// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of Olena.
//
// Olena 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, version 2 of the License.
//
// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
//
// As a special exception, you may use this file as part of a free
// software project 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.
#ifndef MLN_TRACE_ESSENTIAL_HH
# define MLN_TRACE_ESSENTIAL_HH
/*! \file
*
* \brief File that includes essential trace-related routines.
*/
# include <mln/trace/all.hh>
#endif // ! MLN_TRACE_ESSENTIAL_HH
// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of Olena.
//
// Olena 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, version 2 of the License.
//
// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
//
// As a special exception, you may use this file as part of a free
// software project 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.
#ifndef MLN_TRACE_EXITING_HH
# define MLN_TRACE_EXITING_HH
/// \file
///
/// Definition of the trace exiting procedure.
# include <string>
# include <iostream>
# include <stack>
# include <mln/core/contract.hh>
# include <mln/trace/quiet.hh>
namespace mln
{
namespace trace
{
void exiting(const std::string& scope);
extern std::stack<std::clock_t> start_times;
extern std::stack<std::string> scopes; // For testing purpose
// (entering/exiting scope matching).
# ifndef MLN_INCLUDE_ONLY
inline
void exiting(const std::string& scope)
{
if (quiet)
return;
if (scopes.empty())
{
std::cerr << "error: missing 'entering' scope (exiting is '" << scope << "')" << std::endl;
quiet = true;
}
else
{
if (scopes.top() != scope)
{
std::cerr << "error: bad matching scope (entering is '" << scopes.top()
<< "' v. exiting is '" << scope << "')" << std::endl;
quiet = true;
}
scopes.pop();
}
bool has_inner_trace = (internal::max_tab == tab);
--tab;
if (!has_inner_trace)
for (unsigned i = 0; i < tab; ++i)
std::cout << " ";
std::cout << "} ";
if (!has_inner_trace)
std::cout << scope << " ";
mln_assertion(! start_times.empty());
std::clock_t now = std::clock();
if (start_times.top() > now)
{
std::cerr << "warning: bad timer in trace handling" << std::endl;
// FIXME: So what?
}
if (start_times.top() < now)
{
std::cout << "- "
<< ((float(now) - float(start_times.top())) / CLOCKS_PER_SEC)
<< "s ";
}
start_times.pop();
if (has_inner_trace || (internal::max_tab - tab > 1))
std::cout << std::endl;
}
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::trace
} // end of namespace mln
#endif // ! MLN_TRACE_EXITING_HH
// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of Olena.
//
// Olena 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, version 2 of the License.
//
// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
//
// As a special exception, you may use this file as part of a free
// software project 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.
#ifndef MLN_TRACE_QUIET_HH
# define MLN_TRACE_QUIET_HH
/*! \file
*
* \brief Definition of the trace quiet Boolean value.
*/
# include <ctime>
# include <sys/time.h>
namespace mln
{
namespace trace
{
extern bool quiet;
extern unsigned tab ;
extern bool full_trace;
namespace internal
{
extern unsigned max_tab ;
extern timeval start_time;
extern bool is_quiet;
} // end of namespace mln::trace::internal
# ifndef MLN_INCLUDE_ONLY
# ifndef MLN_WO_GLOBAL_VARS
bool quiet = true;
unsigned tab = 0;
bool full_trace = false;
namespace internal
{
unsigned max_tab = 0;
timeval start_time;
bool is_quiet = quiet;
} // end of namespace mln::trace::internal
# endif // !MLN_WO_GLOBAL_VARS
# endif // !MLN_INCLUDE_ONLY
} // end of namespace mln::trace
} // end of namespace mln
#endif // ! MLN_TRACE_QUIET_HH
// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of Olena.
//
// Olena 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, version 2 of the License.
//
// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
//
// As a special exception, you may use this file as part of a free
// software project 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.
#ifndef MLN_TRACE_RESUME_HH
# define MLN_TRACE_RESUME_HH
/// \file
///
/// Resume traces.
/// \sa mln::trace::stop
# include <mln/trace/quiet.hh>
namespace mln
{
namespace trace
{
void resume();
# ifndef MLN_INCLUDE_ONLY
inline
void resume()
{
quiet = internal::is_quiet;
}
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::trace
} // end of namespace mln
#endif // ! MLN_TRACE_RESUME_HH
// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of Olena.
//
// Olena 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, version 2 of the License.
//
// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
//
// As a special exception, you may use this file as part of a free
// software project 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.
#ifndef MLN_TRACE_STOP_HH
# define MLN_TRACE_STOP_HH
/// \file
/// Stop printing traces except if trace::full_trace is enabled.
/// \sa mln::trace::resume
# include <iostream>
# include <mln/trace/quiet.hh>
namespace mln
{
namespace trace
{
void stop();
# ifndef MLN_INCLUDE_ONLY
inline
void stop()
{
internal::is_quiet = quiet;
if (!full_trace)
quiet = true;
}
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::trace
} // end of namespace mln
#endif // ! MLN_TRACE_STOP_HH
// Copyright (C) 2008, 2009, 2010 EPITA Research and Development
// Laboratory (LRDE)
//
// This file is part of Olena.
//
// Olena 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, version 2 of the License.
//
// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
//
// As a special exception, you may use this file as part of a free
// software project 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.
#ifndef MLN_TRACE_WARNING_HH
# define MLN_TRACE_WARNING_HH
/// \file
///
/// Display warning message in trace output.
# include <iostream>
# include <string>
# include <mln/trace/quiet.hh>
namespace mln
{
namespace trace
{
void warning(const std::string& message);
# ifndef MLN_INCLUDE_ONLY
inline
void warning(const std::string& message)
{
std::cerr << "Warning: " << message << std::endl;
}
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::trace
} // end of namespace mln
#endif // ! MLN_TRACE_WARNING_HH
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