Commit 2d20a625 authored by Roland Levillain's avatar Roland Levillain
Browse files

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.
parent 01ee98f5
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> 2010-03-08 Roland Levillain <roland@lrde.epita.fr>
   
Update the documentation's copyright header. Update the documentation's copyright header.
#include <mln/core/image/image2d.hh> #include <mln/core/image/image2d.hh>
#include <mln/io/pbm/save.hh> #include <mln/io/pbm/save.hh>
#include <mln/make/image.hh> #include <mln/make/image.hh>
#include "doc/tools/data.hh"
int main() int main()
{ {
using namespace mln; using namespace mln;
...@@ -15,8 +18,6 @@ int main() ...@@ -15,8 +18,6 @@ int main()
image2d<bool> ima = make::image(vals); image2d<bool> ima = make::image(vals);
// \{ // \{
/* FIXME: Hard-coded paths are bad! Use something like io::pbm::save(ima, MLN_DOC_DIR "/figures/ima_save.pbm");
milena/tests/data.hh.in instead. */
io::pbm::save(ima, "figures/ima_save.pbm");
// \} // \}
} }
/* FIXME: Hard-coded paths are bad! Use something like io::pbm::save(ima, MLN_DOC_DIR "/figures/ima_save.pbm");
milena/tests/data.hh.in instead. */
io::pbm::save(ima, "figures/ima_save.pbm");
// Copyright (C) 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 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 doc directory of Milena.
# define MLN_DOC_DIR "@abs_top_srcdir@/milena/doc"
#endif // ! DOC_TOOLS_HH
// 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 // This file is part of the Milena Library. This library is free
// software; you can redistribute it and/or modify it under the terms // software; you can redistribute it and/or modify it under the terms
...@@ -25,14 +26,16 @@ ...@@ -25,14 +26,16 @@
// reasons why the executable file might be covered by the GNU General // reasons why the executable file might be covered by the GNU General
// Public License. // Public License.
#ifndef DOC_TUTORIAL_TOOLS_SAMPLE_UTILS_HH #ifndef DOC_TOOLS_SAMPLE_UTILS_HH
# define DOC_TUTORIAL_TOOLS_SAMPLE_UTILS_HH # define DOC_TOOLS_SAMPLE_UTILS_HH
# include <mln/core/image/image2d.hh> # include <mln/core/image/image2d.hh>
# include <mln/io/pbm/all.hh> # include <mln/io/pbm/all.hh>
# include <mln/io/pgm/all.hh> # include <mln/io/pgm/all.hh>
# include <mln/io/ppm/all.hh> # include <mln/io/ppm/all.hh>
# include "doc/tools/data.hh"
namespace doc namespace doc
{ {
...@@ -43,9 +46,7 @@ namespace doc ...@@ -43,9 +46,7 @@ namespace doc
static int file_id = 1; static int file_id = 1;
std::ostringstream os; std::ostringstream os;
/* FIXME: Hard-coded paths are bad! Use something like os << MLN_DOC_DIR "/figures/"
milena/tests/data.hh.in instead. */
os << "figures/"
<< name << name
<< "-" << "-"
<< file_id++ << file_id++
...@@ -94,5 +95,5 @@ namespace doc ...@@ -94,5 +95,5 @@ namespace doc
} // end of namespace doc } // end of namespace doc
#endif // ! DOC_TUTORIAL_TOOLS_SAMPLE_UTILS_HH #endif // ! DOC_TOOLS_SAMPLE_UTILS_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