2787: Add trace::stop and trace::resume.
* mln/trace/all.hh: add new includes. * mln/trace/entering.hh: update copyright. * mln/trace/quiet.hh: Add new variables. * mln/trace/resume.hh, * mln/trace/stop.hh: new routines. * mln/core/routine/initialize.hh: Use trace::stop and trace::resume. --- milena/ChangeLog | 14 ++++++++++++ milena/mln/core/routine/initialize.hh | 4 ++- milena/mln/trace/all.hh | 4 ++- milena/mln/trace/entering.hh | 2 +- milena/mln/trace/quiet.hh | 10 ++++++++- milena/mln/trace/{entering.hh => resume.hh} | 29 ++++++++++--------------- milena/mln/trace/{entering.hh => stop.hh} | 30 +++++++++++--------------- 7 files changed, 55 insertions(+), 38 deletions(-) copy milena/mln/trace/{entering.hh => resume.hh} (72%) copy milena/mln/trace/{entering.hh => stop.hh} (72%) diff --git a/milena/ChangeLog b/milena/ChangeLog index ffec9ad..8dfe0f2 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,19 @@ 2008-10-30 Guillaume Lazzara <z@lrde.epita.fr> + Add trace::stop and trace::resume. + + * mln/trace/all.hh: add new includes. + * mln/trace/entering.hh: update copyright. + * mln/trace/quiet.hh: Add new variables. + + * mln/trace/resume.hh, + * mln/trace/stop.hh: new routines. + + * mln/core/routine/initialize.hh: Use trace::stop and trace::resume. + + +2008-10-30 Guillaume Lazzara <z@lrde.epita.fr> + Add more colors and fix global constants initialization in mln/values * mln/literal/colors.hh, diff --git a/milena/mln/core/routine/initialize.hh b/milena/mln/core/routine/initialize.hh index ffd9c85..37d6d58 100644 --- a/milena/mln/core/routine/initialize.hh +++ b/milena/mln/core/routine/initialize.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2007 EPITA Research and Development Laboratory +// Copyright (C) 2007, 2008 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 @@ -61,7 +61,9 @@ namespace mln mln_precondition(! exact(target).has_data()); mln_precondition(exact(model).has_data()); + trace::stop(); init_(tag::image, exact(target), exact(model)); + trace::resume(); mln_postcondition(exact(target).has_data()); trace::exiting("core::initialize"); diff --git a/milena/mln/trace/all.hh b/milena/mln/trace/all.hh index 01b99c2..62b9a60 100644 --- a/milena/mln/trace/all.hh +++ b/milena/mln/trace/all.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2007 EPITA Research and Development Laboratory +// Copyright (C) 2007, 2008 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 @@ -46,6 +46,8 @@ 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> #endif // ! MLN_TRACE_ALL_HH diff --git a/milena/mln/trace/entering.hh b/milena/mln/trace/entering.hh index e9d66ce..3737a1c 100644 --- a/milena/mln/trace/entering.hh +++ b/milena/mln/trace/entering.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2007 EPITA Research and Development Laboratory +// Copyright (C) 2007, 2008 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 diff --git a/milena/mln/trace/quiet.hh b/milena/mln/trace/quiet.hh index ef1a00b..0a98bd4 100644 --- a/milena/mln/trace/quiet.hh +++ b/milena/mln/trace/quiet.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2007 EPITA Research and Development Laboratory +// Copyright (C) 2007, 2008 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 @@ -42,6 +42,14 @@ namespace mln static bool quiet = true; static unsigned tab = 0; + static bool full_trace = false; + + namespace internal + { + + static bool is_quiet = quiet; + + } // end of namespace mln::trace::internal } // end of namespace mln::trace diff --git a/milena/mln/trace/entering.hh b/milena/mln/trace/resume.hh similarity index 72% copy from milena/mln/trace/entering.hh copy to milena/mln/trace/resume.hh index e9d66ce..3520bd6 100644 --- a/milena/mln/trace/entering.hh +++ b/milena/mln/trace/resume.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2007 EPITA Research and Development Laboratory +// Copyright (C) 2008 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 @@ -16,7 +16,7 @@ // Boston, MA 02111-1307, USA. // // As a special exception, you may use this file as part of a free -// software library without restriction. Specificenteringy, if other files +// software library without restriction. Specificresumey, 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 @@ -25,13 +25,13 @@ // reasons why the executable file might be covered by the GNU General // Public License. -#ifndef MLN_TRACE_ENTERING_HH -# define MLN_TRACE_ENTERING_HH +#ifndef MLN_TRACE_RESUME_HH +# define MLN_TRACE_RESUME_HH -/*! \file mln/trace/entering.hh - * - * \brief Definition of the trace entering procedure. - */ +/// \file mln/trace/resume.hh +/// +/// Resume traces. +/// \sa mln::trace::stop # include <string> # include <iostream> @@ -45,19 +45,14 @@ namespace mln namespace trace { - void entering(const std::string& scope); + void resume(); # ifndef MLN_INCLUDE_ONLY inline - void entering(const std::string& scope) + void resume() { - if (quiet) - return; - for (unsigned i = 0; i < tab; ++i) - std::cout << " "; - std::cout << scope << " {" << std::endl; - ++tab; + quiet = internal::is_quiet; } # endif // ! MLN_INCLUDE_ONLY @@ -67,4 +62,4 @@ namespace mln } // end of namespace mln -#endif // ! MLN_TRACE_ENTERING_HH +#endif // ! MLN_TRACE_RESUME_HH diff --git a/milena/mln/trace/entering.hh b/milena/mln/trace/stop.hh similarity index 72% copy from milena/mln/trace/entering.hh copy to milena/mln/trace/stop.hh index e9d66ce..e810c97 100644 --- a/milena/mln/trace/entering.hh +++ b/milena/mln/trace/stop.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2007 EPITA Research and Development Laboratory +// Copyright (C) 2008 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 @@ -16,7 +16,7 @@ // Boston, MA 02111-1307, USA. // // As a special exception, you may use this file as part of a free -// software library without restriction. Specificenteringy, if other files +// software library without restriction. Specificstopy, 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 @@ -25,13 +25,12 @@ // reasons why the executable file might be covered by the GNU General // Public License. -#ifndef MLN_TRACE_ENTERING_HH -# define MLN_TRACE_ENTERING_HH +#ifndef MLN_TRACE_STOP_HH +# define MLN_TRACE_STOP_HH -/*! \file mln/trace/entering.hh - * - * \brief Definition of the trace entering procedure. - */ +/// \file mln/trace/stop.hh +/// Stop printing traces except if trace::full_trace is enabled. +/// \sa mln::trace::resume # include <string> # include <iostream> @@ -45,19 +44,16 @@ namespace mln namespace trace { - void entering(const std::string& scope); + void stop(); # ifndef MLN_INCLUDE_ONLY inline - void entering(const std::string& scope) + void stop() { - if (quiet) - return; - for (unsigned i = 0; i < tab; ++i) - std::cout << " "; - std::cout << scope << " {" << std::endl; - ++tab; + internal::is_quiet = quiet; + if (!full_trace) + quiet = true; } # endif // ! MLN_INCLUDE_ONLY @@ -67,4 +63,4 @@ namespace mln } // end of namespace mln -#endif // ! MLN_TRACE_ENTERING_HH +#endif // ! MLN_TRACE_STOP_HH -- 1.5.6.5
participants (1)
-
Guillaume Lazzara