
* mln/border/thickness.hh, * mln/debug/colorize.hh, * mln/tag/init.hh, * mln/trace/quiet.hh: use extern and move implementation within MLN_INCLUDE_ONLY. --- milena/ChangeLog | 10 ++++++++++ milena/mln/border/thickness.hh | 9 +++++++-- milena/mln/debug/colorize.hh | 10 ++++++++-- milena/mln/tag/init.hh | 24 +++++++++++++++++------- milena/mln/trace/quiet.hh | 30 ++++++++++++++++++++++++------ 5 files changed, 66 insertions(+), 17 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index 6a7bde2..e14e709 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,3 +1,13 @@ +2008-11-05 Guillaume Lazzara <z@lrde.epita.fr> + + Fix the initialization of all global constants. (#43) + + * mln/border/thickness.hh, + * mln/debug/colorize.hh, + * mln/tag/init.hh, + * mln/trace/quiet.hh: use extern and move implementation within + MLN_INCLUDE_ONLY. + 2008-11-05 Ugo Jardonnet <ugo.jardonnet@lrde.epita.fr> Fix mln/accu/maj_h.hh. diff --git a/milena/mln/border/thickness.hh b/milena/mln/border/thickness.hh index 7f953f9..499c0e9 100644 --- a/milena/mln/border/thickness.hh +++ b/milena/mln/border/thickness.hh @@ -41,8 +41,13 @@ namespace mln namespace border { - // FIXME: Make this a proper global (issue #43). - static unsigned thickness = 3; + extern unsigned thickness; + +# ifndef MLN_INCLUDE_ONLY + + unsigned thickness = 3; + +# endif // !MLN_INCLUDE_ONLY } // end of namespace mln::border diff --git a/milena/mln/debug/colorize.hh b/milena/mln/debug/colorize.hh index 179518e..c997921 100644 --- a/milena/mln/debug/colorize.hh +++ b/milena/mln/debug/colorize.hh @@ -48,8 +48,8 @@ namespace mln namespace colorize_ { - static unsigned min_value = 20; - static unsigned max_value = 220; + extern unsigned min_value; + extern unsigned max_value; } @@ -70,6 +70,12 @@ namespace mln # ifndef MLN_INCLUDE_ONLY + namespace colorize_ + { + unsigned min_value = 20; + unsigned max_value = 220; + } + namespace internal { diff --git a/milena/mln/tag/init.hh b/milena/mln/tag/init.hh index 37039d9..e6921a7 100644 --- a/milena/mln/tag/init.hh +++ b/milena/mln/tag/init.hh @@ -47,13 +47,23 @@ namespace mln struct extension_t {}; struct function_t {}; - // FIXME: Make these proper globals (issue #43). - static const image_t image = image_t(); - static const domain_t domain = domain_t(); - static const bbox_t bbox = bbox_t(); - static const border_t border = border_t(); - static const extension_t extension = extension_t(); - static const function_t function = function_t(); + extern const image_t& image; + extern const domain_t& domain; + extern const bbox_t& bbox; + extern const border_t& border; + extern const extension_t& extension; + extern const function_t& function; + +# ifndef MLN_INCLUDE_ONLY + + const image_t& image = image_t(); + const domain_t& domain = domain_t(); + const bbox_t& bbox = bbox_t(); + const border_t& border = border_t(); + const extension_t& extension = extension_t(); + const function_t& function = function_t(); + +# endif // !MLN_INCLUDE_ONLY } // end of namespace mln::tag diff --git a/milena/mln/trace/quiet.hh b/milena/mln/trace/quiet.hh index e7467f0..dfcca01 100644 --- a/milena/mln/trace/quiet.hh +++ b/milena/mln/trace/quiet.hh @@ -42,20 +42,38 @@ namespace mln namespace trace { - static bool quiet = true; - static unsigned tab = 0; - static bool full_trace = false; + extern bool quiet; + extern unsigned tab ; + extern bool full_trace; namespace internal { - static unsigned max_tab = 0; - static timeval start_time; - static bool is_quiet = quiet; + extern unsigned max_tab ; + extern timeval start_time; + extern bool is_quiet; } // end of namespace mln::trace::internal +# ifndef MLN_INCLUDE_ONLY + + 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_INCLUDE_ONLY + } // end of namespace mln::trace } // end of namespace mln -- 1.5.6.5