
* doc/tools/data.hh.in: New file. Use it... * doc/examples/ima-save.cc: ...here, to avoid hard-coded paths. * doc/tools/sample_utils.hh: Likewise. Adjust header guards. * doc/examples/split/ima-save-1.cc.raw: Regen. --- milena/ChangeLog | 12 ++++++++++++ milena/doc/examples/ima-save.cc | 7 ++++--- milena/doc/examples/split/ima-save-1.cc.raw | 4 +--- milena/{apps => doc/tools}/data.hh.in | 16 ++++++---------- milena/doc/tools/sample_utils.hh | 15 ++++++++------- 5 files changed, 31 insertions(+), 23 deletions(-) copy milena/{apps => doc/tools}/data.hh.in (78%) diff --git a/milena/ChangeLog b/milena/ChangeLog index 8c60e0e..39f43ac 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,3 +1,15 @@ +2010-03-12 Roland Levillain <roland@lrde.epita.fr> + + Have documentation's examples not depend on hard-coded paths. + + * doc/tools/data.hh.in: New file. + Use it... + * doc/examples/ima-save.cc: + ...here, to avoid hard-coded paths. + * doc/tools/sample_utils.hh: Likewise. + Adjust header guards. + * doc/examples/split/ima-save-1.cc.raw: Regen. + 2010-03-08 Roland Levillain <roland@lrde.epita.fr> Update the documentation's copyright header. diff --git a/milena/doc/examples/ima-save.cc b/milena/doc/examples/ima-save.cc index 91c8226..b93945b 100644 --- a/milena/doc/examples/ima-save.cc +++ b/milena/doc/examples/ima-save.cc @@ -1,6 +1,9 @@ #include <mln/core/image/image2d.hh> #include <mln/io/pbm/save.hh> #include <mln/make/image.hh> + +#include "doc/tools/data.hh" + int main() { using namespace mln; @@ -15,8 +18,6 @@ int main() image2d<bool> ima = make::image(vals); // \{ - /* FIXME: Hard-coded paths are bad! Use something like - milena/tests/data.hh.in instead. */ - io::pbm::save(ima, "figures/ima_save.pbm"); + io::pbm::save(ima, MLN_DOC_DIR "/figures/ima_save.pbm"); // \} } diff --git a/milena/doc/examples/split/ima-save-1.cc.raw b/milena/doc/examples/split/ima-save-1.cc.raw index 98d029c..7db0408 100644 --- a/milena/doc/examples/split/ima-save-1.cc.raw +++ b/milena/doc/examples/split/ima-save-1.cc.raw @@ -1,3 +1 @@ - /* FIXME: Hard-coded paths are bad! Use something like - milena/tests/data.hh.in instead. */ - io::pbm::save(ima, "figures/ima_save.pbm"); + io::pbm::save(ima, MLN_DOC_DIR "/figures/ima_save.pbm"); diff --git a/milena/apps/data.hh.in b/milena/doc/tools/data.hh.in similarity index 78% copy from milena/apps/data.hh.in copy to milena/doc/tools/data.hh.in index 8adb35f..c300521 100644 --- a/milena/apps/data.hh.in +++ b/milena/doc/tools/data.hh.in @@ -1,5 +1,4 @@ -// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory -// (LRDE) +// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) // // This file is part of Olena. // @@ -24,18 +23,15 @@ // exception does not however invalidate any other reasons why the // executable file might be covered by the GNU General Public License. -#ifndef APPS_DATA_HH -# define APPS_DATA_HH +#ifndef DOC_TOOLS_HH +# define DOC_TOOLS_HH # include <string> /* Macros are evil, but they save us an extra compilation unit here (as well as additional burden in Makefiles, too.). */ -/// The absolute path to the img directory of Milena. -# define MLN_IMG_DIR "@abs_top_srcdir@/milena/img" +/// The absolute path to the doc directory of Milena. +# define MLN_DOC_DIR "@abs_top_srcdir@/milena/doc" -/// The absolute path to the apps directory of Milena. -# define MLN_APPS_DIR "@abs_top_srcdir@/milena/apps/" - -#endif // ! APPS_DATA_HH +#endif // ! DOC_TOOLS_HH diff --git a/milena/doc/tools/sample_utils.hh b/milena/doc/tools/sample_utils.hh index 6ef802d..e7e3f81 100644 --- a/milena/doc/tools/sample_utils.hh +++ b/milena/doc/tools/sample_utils.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2008, 2009, 2010 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of the Milena Library. This library is free // software; you can redistribute it and/or modify it under the terms @@ -25,14 +26,16 @@ // reasons why the executable file might be covered by the GNU General // Public License. -#ifndef DOC_TUTORIAL_TOOLS_SAMPLE_UTILS_HH -# define DOC_TUTORIAL_TOOLS_SAMPLE_UTILS_HH +#ifndef DOC_TOOLS_SAMPLE_UTILS_HH +# define DOC_TOOLS_SAMPLE_UTILS_HH # include <mln/core/image/image2d.hh> # include <mln/io/pbm/all.hh> # include <mln/io/pgm/all.hh> # include <mln/io/ppm/all.hh> +# include "doc/tools/data.hh" + namespace doc { @@ -43,9 +46,7 @@ namespace doc static int file_id = 1; std::ostringstream os; - /* FIXME: Hard-coded paths are bad! Use something like - milena/tests/data.hh.in instead. */ - os << "figures/" + os << MLN_DOC_DIR "/figures/" << name << "-" << file_id++ @@ -94,5 +95,5 @@ namespace doc } // end of namespace doc -#endif // ! DOC_TUTORIAL_TOOLS_SAMPLE_UTILS_HH +#endif // ! DOC_TOOLS_SAMPLE_UTILS_HH -- 1.5.6.5