[PATCH] Replace exported global variables with static ones.

This allows for separate compilation. * milena/mln/border/thickness.hh, * milena/mln/literal/black.hh, * milena/mln/literal/colors.hh, * milena/mln/literal/grays.hh, * milena/mln/literal/one.hh, * milena/mln/literal/origin.hh, * milena/mln/literal/white.hh, * milena/mln/literal/zero.hh, * milena/mln/tag/init.hh: Here. * milena/mln/trace/entering.hh: Add a missing `inline'. * milena/mln/trace/exiting.hh: Kill trailing whitespaces. Signed-off-by: Benoit Sigoure <tsuna@lrde.epita.fr> --- I pushed this change. Cheers, milena/ChangeLog | 16 ++++++++++++++++ milena/mln/border/thickness.hh | 3 ++- milena/mln/literal/black.hh | 10 ++-------- milena/mln/literal/colors.hh | 17 ++++++----------- milena/mln/literal/grays.hh | 10 ++-------- milena/mln/literal/one.hh | 5 ++--- milena/mln/literal/origin.hh | 10 ++-------- milena/mln/literal/white.hh | 9 ++------- milena/mln/literal/zero.hh | 5 ++--- milena/mln/tag/init.hh | 17 ++++++++++++----- milena/mln/trace/entering.hh | 3 ++- milena/mln/trace/exiting.hh | 2 +- 12 files changed, 51 insertions(+), 56 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index 09c6932..f7896cc 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,3 +1,19 @@ +2007-11-29 Benoit Sigoure <tsuna@lrde.epita.fr> + + Replace exported global variables with static ones. + This allows for separate compilation. + * milena/mln/border/thickness.hh, + * milena/mln/literal/black.hh, + * milena/mln/literal/colors.hh, + * milena/mln/literal/grays.hh, + * milena/mln/literal/one.hh, + * milena/mln/literal/origin.hh, + * milena/mln/literal/white.hh, + * milena/mln/literal/zero.hh, + * milena/mln/tag/init.hh: Here. + * milena/mln/trace/entering.hh: Add a missing `inline'. + * milena/mln/trace/exiting.hh: Kill trailing whitespaces. + 2007-11-28 Benoit Sigoure <tsuna@lrde.epita.fr> Add the missing inline keywords. diff --git a/milena/mln/border/thickness.hh b/milena/mln/border/thickness.hh index bcb3096..7f953f9 100644 --- a/milena/mln/border/thickness.hh +++ b/milena/mln/border/thickness.hh @@ -41,7 +41,8 @@ namespace mln namespace border { - unsigned thickness = 3; + // FIXME: Make this a proper global (issue #43). + static unsigned thickness = 3; } // end of namespace mln::border diff --git a/milena/mln/literal/black.hh b/milena/mln/literal/black.hh index b20dbb2..7307420 100644 --- a/milena/mln/literal/black.hh +++ b/milena/mln/literal/black.hh @@ -48,14 +48,8 @@ namespace mln /// Literal black. - extern const black_t& black; - - -# ifndef MLN_INCLUDE_ONLY - - const black_t& black = black_t(); - -# endif // ! MLN_INCLUDE_ONLY + // FIXME: Make this a proper global (issue #43). + static const black_t black = black_t(); } // end of namespace mln::literal diff --git a/milena/mln/literal/colors.hh b/milena/mln/literal/colors.hh index adca17f..a006dc1 100644 --- a/milena/mln/literal/colors.hh +++ b/milena/mln/literal/colors.hh @@ -58,21 +58,16 @@ namespace mln /// Literal red. - extern const red_t& red; + // FIXME: Make this a proper global (issue #43). + static const red_t red = red_t(); /// Literal green. - extern const green_t& green; + // FIXME: Make this a proper global (issue #43). + static const green_t green = green_t(); /// Literal blue. - extern const blue_t& blue; - -# ifndef MLN_INCLUDE_ONLY - - const red_t& red = red_t(); - const green_t& green = green_t(); - const blue_t& blue = blue_t(); - -# endif // ! MLN_INCLUDE_ONLY + // FIXME: Make this a proper global (issue #43). + static const blue_t blue = blue_t(); } // end of namespace mln::literal diff --git a/milena/mln/literal/grays.hh b/milena/mln/literal/grays.hh index 438de9e..b9a6ad6 100644 --- a/milena/mln/literal/grays.hh +++ b/milena/mln/literal/grays.hh @@ -47,14 +47,8 @@ namespace mln }; /// Literal medium_gray. - extern const medium_gray_t& medium_gray; - - -# ifndef MLN_INCLUDE_ONLY - - const medium_gray_t& medium_gray = medium_gray_t(); - -# endif // ! MLN_INCLUDE_ONLY + // FIXME: Make this a proper global (issue #43). + static const medium_gray_t medium_gray = medium_gray_t(); } // end of namespace mln::literal diff --git a/milena/mln/literal/one.hh b/milena/mln/literal/one.hh index 3b9d855..699819f 100644 --- a/milena/mln/literal/one.hh +++ b/milena/mln/literal/one.hh @@ -54,7 +54,8 @@ namespace mln /// Literal one. - extern const one_t& one; + // FIXME: Make this a proper global (issue #43). + static const one_t one = one_t(); # ifndef MLN_INCLUDE_ONLY @@ -67,8 +68,6 @@ namespace mln return 1; } - const one_t& one = one_t(); - # endif // ! MLN_INCLUDE_ONLY } // end of namespace mln::literal diff --git a/milena/mln/literal/origin.hh b/milena/mln/literal/origin.hh index bceadf7..5f64726 100644 --- a/milena/mln/literal/origin.hh +++ b/milena/mln/literal/origin.hh @@ -48,14 +48,8 @@ namespace mln }; /// Literal origin. - extern const origin_t& origin; - -# ifndef MLN_INCLUDE_ONLY - - const origin_t& origin = origin_t(); - -# endif // ! MLN_INCLUDE_ONLY - + // FIXME: Make this a proper global (issue #43). + static const origin_t origin = origin_t(); } // end of namespace mln::literal diff --git a/milena/mln/literal/white.hh b/milena/mln/literal/white.hh index 8fc0336..c8c5bf8 100644 --- a/milena/mln/literal/white.hh +++ b/milena/mln/literal/white.hh @@ -48,15 +48,10 @@ namespace mln /// Literal white. - extern const white_t& white; + // FIXME: Make this a proper global (issue #43). + static const white_t white = white_t(); -# ifndef MLN_INCLUDE_ONLY - - const white_t& white = white_t(); - -# endif // ! MLN_INCLUDE_ONLY - } // end of namespace mln::literal } // end of namespace mln diff --git a/milena/mln/literal/zero.hh b/milena/mln/literal/zero.hh index 88edc7c..f35f8a3 100644 --- a/milena/mln/literal/zero.hh +++ b/milena/mln/literal/zero.hh @@ -56,7 +56,8 @@ namespace mln /// Literal zero. - extern const zero_t& zero; + // FIXME: Make this a proper global (issue #43). + static const zero_t zero = zero_t(); # ifndef MLN_INCLUDE_ONLY @@ -69,8 +70,6 @@ namespace mln return 0; } - const zero_t& zero = zero_t(); - # endif // ! MLN_INCLUDE_ONLY } // end of namespace mln::literal diff --git a/milena/mln/tag/init.hh b/milena/mln/tag/init.hh index 3a63d90..59a986d 100644 --- a/milena/mln/tag/init.hh +++ b/milena/mln/tag/init.hh @@ -40,11 +40,18 @@ namespace mln namespace tag { - struct image_t {} image; - struct domain_t {} domain; - struct bbox_t {} bbox; - struct border_t {} border; - struct function_t {} function; + struct image_t {}; + struct domain_t {}; + struct bbox_t {}; + struct border_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 function_t function = function_t(); } // end of namespace mln::tag diff --git a/milena/mln/trace/entering.hh b/milena/mln/trace/entering.hh index 9603ea0..e9d66ce 100644 --- a/milena/mln/trace/entering.hh +++ b/milena/mln/trace/entering.hh @@ -49,6 +49,7 @@ namespace mln # ifndef MLN_INCLUDE_ONLY + inline void entering(const std::string& scope) { if (quiet) @@ -58,7 +59,7 @@ namespace mln std::cout << scope << " {" << std::endl; ++tab; } - + # endif // ! MLN_INCLUDE_ONLY } // end of namespace mln::trace diff --git a/milena/mln/trace/exiting.hh b/milena/mln/trace/exiting.hh index d690dd1..b9595f5 100644 --- a/milena/mln/trace/exiting.hh +++ b/milena/mln/trace/exiting.hh @@ -59,7 +59,7 @@ namespace mln std::cout << " "; std::cout << "}" << std::endl; } - + # endif // ! MLN_INCLUDE_ONLY } // end of namespace mln::trace -- 1.5.3.5.756.gc887a
participants (1)
-
Benoit Sigoure