
Index: ChangeLog from Giovanni Palma <giovanni@lrde.epita.fr> * NEWS: Describe new way to document. * configure.ac: Add configuration files for doc. Index: doc/ChangeLog from Giovanni Palma <giovanni@lrde.epita.fr> * ref/img_conv.pl: Add script for image conversion. * ref/exdoc.mk.in: Add exdoc config file. * ref/exdoc.config.in: Likewise. * ref/doxygen.config.in: Add doxygen config file. * ref/exdoc.pl: Add script to extract code from comments. * ref/Makefile.am: Make Makefile use new doc tools. Index: olena/ChangeLog from Giovanni Palma <giovanni@lrde.epita.fr> * oln/morpho/attribute_closing_opening.hh: Add comments. * oln/core/abstract/behavior.hh: Likewise. * oln/core/behavior.hh: Likewise. Index: configure.ac --- configure.ac Sun, 21 Sep 2003 23:54:00 +0200 burrus_n (oln/3_configure. 1.47.1.1.1.1.1.4.1.15.1.13 640) +++ configure.ac Mon, 23 Feb 2004 16:59:35 +0100 palma_g (oln/3_configure. 1.47.1.1.1.1.1.4.1.15.1.13 640) @@ -231,6 +231,17 @@ ### Stuff pertaining to the documentation ### +### The reference manual uses Doxygen +### FIXME: could be much better. + +AC_CHECK_PROG([DOXYGEN], [doxygen], [doxygen]) +## if test -z "$DOXYGEN"; then +## AC_MSG_WARN([`doxygen' not found -- `doxygen' must be installed to generate the documentation]) +AC_CONFIG_FILES([doc/ref/doxygen.config + doc/ref/exdoc.config + doc/ref/exdoc.mk]) +## fi + ### The documentation tree is both a component... OLN_COMPONENT([doc], Index: doc/ref/Makefile.am --- doc/ref/Makefile.am Mon, 11 Aug 2003 15:35:58 +0200 burrus_n (oln/d/51_Makefile.a 1.27.1.8 640) +++ doc/ref/Makefile.am Tue, 24 Feb 2004 15:44:53 +0100 palma_g (oln/d/51_Makefile.a 1.27.1.8 640) @@ -1,106 +1,142 @@ -### -### General definitions -### +# ### +# ### General definitions +# ### -TEXI2PDF = $(TEXI2DVI) --pdf -TEXI2PDF_FLAGS = --batch -I $(srcdir)/graphics +# TEXI2PDF = $(TEXI2DVI) --pdf +# TEXI2PDF_FLAGS = --batch -I $(srcdir)/graphics -TEXI2DVI_FLAGS = --batch -I $(srcdir)/graphics +# TEXI2DVI_FLAGS = --batch -I $(srcdir)/graphics olnsrc = $(top_srcdir)/olena/oln -include $(srcdir)/filelists.make +# include $(srcdir)/filelists.make -$(srcdir)/filelists.make: $(srcdir)/gen_filelists.sh - $(SHELL) $@ $(olnsrc) +# $(srcdir)/filelists.make: $(srcdir)/gen_filelists.sh +# $(SHELL) $@ $(olnsrc) -$(srcdir)/Makefile.in: $(srcdir)/filelists.make +# $(srcdir)/Makefile.in: $(srcdir)/filelists.make -### -### Auto-generation of TeX files. -### - -AM_LDFLAGS = $(LDFLAGS) $(ZLIB_LDFLAGS) -AM_CXXFLAGS = $(CXXFLAGS) $(ZLIB_CXXFLAGS) - -INCLUDES = -I$(top_srcdir)/olena -I$(top_builddir)/olena -COMMONGETDEFSFLAGS = --agarg=-DCXXCOMPILE="$(CXX) -I$(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS) $(AM_CXXFLAGS) $(AM_LDFLAGS)" \ - --agarg=-DEPSTOPDF="$(EPSTOPDF)" \ - --agarg=-DCONVERT="$(IMAGEMAGICK_CONVERT)" \ - --agarg=--templ-dirs=$(srcdir) \ - --agarg=-DIMGDIR=$(top_srcdir)/olena/img -PROCESSINGGETDEFSFLAGS = \ - --subblock=tpl=type,name,doc \ - --subblock=arg=type,name,mode,doc \ - --listattr=exh \ - --listattr=ns \ - --template $(srcdir)/processing.tpl \ - --srcfile - -ref-morpho.tex: $(morpho_files) $(srcdir)/processing.tpl - $(GETDEFS) $(COMMONGETDEFSFLAGS) $(PROCESSINGGETDEFSFLAGS) \ - $(GETDEFSFLAGS) --base-name=ref-morpho $(morpho_files) - -ref-level.tex: $(level_files) $(srcdir)/processing.tpl - $(GETDEFS) $(COMMONGETDEFSFLAGS) $(PROCESSINGGETDEFSFLAGS) \ - $(GETDEFSFLAGS) --base-name=ref-level $(level_files) - -### -### Rules to build the manuals. -### - -tex_TEX = oln-ref.tex - -built_oln_ref_TEX = ref-morpho.tex ref-level.tex -oln_ref_TEX = $(built_oln_ref_TEX) integre-ref.tex - -oln-ref.dvi: $(tex_TEX) $(oln_ref_TEX) $(graphics_DIA) - $(TEXI2DVI) $(TEXI2DVI_FLAGS) \ - `test -f '$(tex_TEX)' || echo '$(srcdir)/'`$(tex_TEX) - -oln-ref.pdf: $(tex_TEX) $(oln_ref_TEX) $(graphics_DIA) - $(TEXI2PDF) $(TEXI2PDF_FLAGS) \ - `test -f '$(tex_TEX)' || echo '$(srcdir)/'`$(tex_TEX) - -# This rule is not activated by default since the generated files cannot -# be easily distributed (automake barks loudly when the filenames are -# not known at the time Makefile.in is generated) - -# FIXME: uncomment when ready -# cp $(srcdir)/graphics/*-html.png html/ - -html.tar.gz: $(tex_TEX) $(oln_ref_TEX) $(graphics_DIA) - $(HEVEA) -fix -o html/oln-ref.html -I $(srcdir) -I $(srcdir)/graphics `test -f '$(tex_TEX)' || echo '$(srcdir)/'`$(tex_TEX) - cd html && $(HACHA) -tocbis -o index.html oln-ref.html; cd .. - $(TAR) -czf $@ html +# ### +# ### Auto-generation of TeX files. +# ### + +# AM_LDFLAGS = $(LDFLAGS) $(ZLIB_LDFLAGS) +# AM_CXXFLAGS = $(CXXFLAGS) $(ZLIB_CXXFLAGS) + +# INCLUDES = -I$(top_srcdir)/olena -I$(top_builddir)/olena +# COMMONGETDEFSFLAGS = --agarg=-DCXXCOMPILE="$(CXX) -I$(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS) $(AM_CXXFLAGS) $(AM_LDFLAGS)" \ +# --agarg=-DEPSTOPDF="$(EPSTOPDF)" \ +# --agarg=-DCONVERT="$(IMAGEMAGICK_CONVERT)" \ +# --agarg=--templ-dirs=$(srcdir) \ +# --agarg=-DIMGDIR=$(top_srcdir)/olena/img +# PROCESSINGGETDEFSFLAGS = \ +# --subblock=tpl=type,name,doc \ +# --subblock=arg=type,name,mode,doc \ +# --listattr=exh \ +# --listattr=ns \ +# --template $(srcdir)/processing.tpl \ +# --srcfile + +# ref-morpho.tex: $(morpho_files) $(srcdir)/processing.tpl +# $(GETDEFS) $(COMMONGETDEFSFLAGS) $(PROCESSINGGETDEFSFLAGS) \ +# $(GETDEFSFLAGS) --base-name=ref-morpho $(morpho_files) + +# ref-level.tex: $(level_files) $(srcdir)/processing.tpl +# $(GETDEFS) $(COMMONGETDEFSFLAGS) $(PROCESSINGGETDEFSFLAGS) \ +# $(GETDEFSFLAGS) --base-name=ref-level $(level_files) + +# ### +# ### Rules to build the manuals. +# ### + +# tex_TEX = oln-ref.tex + +# built_oln_ref_TEX = ref-morpho.tex ref-level.tex +# oln_ref_TEX = $(built_oln_ref_TEX) integre-ref.tex + +# oln-ref.dvi: $(tex_TEX) $(oln_ref_TEX) $(graphics_DIA) +# $(TEXI2DVI) $(TEXI2DVI_FLAGS) \ +# `test -f '$(tex_TEX)' || echo '$(srcdir)/'`$(tex_TEX) + +DOXYGEN = doxygen +EXDOC = $(srcdir)/exdoc.pl +OUT_DIR = "out" +IMG_CONV = $(srcdir)/img_conv.pl +code: + $(EXDOC) --config=exdoc.config --output-dir=$(OUT_DIR) --input-dir=$(top_srcdir) + +execute: code + mkdir -p img + cd $(OUT_DIR) && make -f makefile + +images: execute + $(IMG_CONV) $(top_srcdir)/olena/img img + $(IMG_CONV) img img -### -### What gets distributed. -### +doxygen: images + $(DOXYGEN) doxygen.config -dist_noinst_DATA = oln-ref.pdf oln-ref.dvi bin.tar.gz html.tar.gz +html: doxygen -EXTRA_DIST = $(tex_TEX) $(oln_ref_TEX) \ - processing.tpl filelists.make gen_filelists.sh -bin.tar.gz: oln-ref.pdf oln-ref.dvi - $(TAR) -czf $@ `test -f bin/lena256.pdf || echo '$(srcdir)/'`bin +doc: html pdf -### -### What gets cleaned. -### + +oln-ref.pdf: doxygen + cd latex && make && cp refman.pdf ../$@ + + +# oln-ref.pdf: $(tex_TEX) $(oln_ref_TEX) $(graphics_DIA) +# $(TEXI2PDF) $(TEXI2PDF_FLAGS) \ +# `test -f '$(tex_TEX)' || echo '$(srcdir)/'`$(tex_TEX) + +# # This rule is not activated by default since the generated files cannot +# # be easily distributed (automake barks loudly when the filenames are +# # not known at the time Makefile.in is generated) + +# # FIXME: uncomment when ready +# # cp $(srcdir)/graphics/*-html.png html/ + +# html.tar.gz: $(tex_TEX) $(oln_ref_TEX) $(graphics_DIA) +# $(HEVEA) -fix -o html/oln-ref.html -I $(srcdir) -I $(srcdir)/graphics `test -f '$(tex_TEX)' || echo '$(srcdir)/'`$(tex_TEX) +# cd html && $(HACHA) -tocbis -o index.html oln-ref.html; cd .. +# $(TAR) -czf $@ html + +html.tar.gz: html + $(TAR) -czf $@ html + +# ### +# ### What gets distributed. +# ### + +dist_noinst_DATA = oln-ref.pdf html.tar.gz + +# EXTRA_DIST = $(tex_TEX) $(oln_ref_TEX) \ +# processing.tpl filelists.make gen_filelists.sh + +# bin.tar.gz: oln-ref.pdf oln-ref.dvi +# $(TAR) -czf $@ `test -f bin/lena256.pdf || echo '$(srcdir)/'`bin + +# ### +# ### What gets cleaned. +# ### +# dist-local: +# rm -f bin/*a.out$(EXEEXT) dist-local: - rm -f bin/*a.out$(EXEEXT) + rm -f img/* -MAINTAINERCLEANFILES = $(built_oln_ref_TEX) $(dist_noinst_DATA) \ - $(srcdir)/html/* $(srcdir)/bin/* \ - $(srcdir)/filelists.make +# MAINTAINERCLEANFILES = $(built_oln_ref_TEX) $(dist_noinst_DATA) \ +# $(srcdir)/html/* $(srcdir)/bin/* \ +# $(srcdir)/filelists.make -CLEANFILES = = *.tmp *.aux *.bbl *blg *.lot *.log *.out *.toc +MAINTAINERCLEANFILES = $(dist_noinst_DATA) \ + ./html/* ./img/* $(OUT_DIR)/* -### -### What gets installed. -### +# CLEANFILES = = *.tmp *.aux *.bbl *blg *.lot *.log *.out *.toc + +# ### +# ### What gets installed. +# ### docdir = $(datadir)/doc/@PACKAGE_TARNAME@ @@ -120,3 +156,4 @@ echo " rm -f $(DESTDIR)$(docdir)/$$p1"; \ rm -f $(DESTDIR)$(docdir)/$$p1; \ done + Index: NEWS --- NEWS Tue, 10 Feb 2004 17:32:17 +0100 palma_g (oln/0_NEWS 1.19 640) +++ NEWS Tue, 24 Feb 2004 15:21:04 +0100 palma_g (oln/0_NEWS 1.19 640) @@ -1,5 +1,22 @@ Olena 0.10 Not yet + * New documentaion system. + Now any comment should use doxygen style (i.e. /*! ... */). + You can also put some code in comments to make them + compile at documentation generation time. It is useful to + illustrate some algorithm with concrete input and output. To + use this feature the only thing to be done is to put the + code into \code and \endcode tags. If you produce an image, + you can include it in the comments with the \image command, + using the same name you used to produce it, but with the png + extension. To make sure your image will not overwrite + another existing one, you should name it with taking care of + the name of the file you are writing in: e.g. if you comment the + file oln/core/behavior.hh, an image should be named + oln_core_behavior_hh_whatever_you_want.ppm It can be added that + two macros are provided to make abstraction of input and + output direcectories, they are named IMG_IN and IMG_OUT. + * Border behavior can be controlled with the behavior hierarchy. If an algorithm support it, you can choose the way the image border will be seen. Three behaviors are available: mirror, Index: olena/oln/morpho/attribute_closing_opening.hh --- olena/oln/morpho/attribute_closing_opening.hh Mon, 16 Feb 2004 19:06:24 +0100 palma_g (oln/q/49_attribute_ 1.14 640) +++ olena/oln/morpho/attribute_closing_opening.hh Tue, 24 Feb 2004 16:20:46 +0100 palma_g (oln/q/49_attribute_ 1.14 640) @@ -30,13 +30,50 @@ #include <oln/morpho/attribute_union_find.hh> +/*! \namespace oln +** \brief oln namespace +*/ namespace oln { + /*! \namespace oln::morpho + ** \brief oln::morpho namespace + */ namespace morpho { + /*! \namespace oln::morpho::fast + ** \brief oln::morpho::fast namespace + */ namespace fast { + /*! \namespace oln::morpho::fast::tarjan + ** \brief oln::morpho::fast::tarjan namespace + */ namespace tarjan { + /*! \namespace oln::morpho::fast::tarjan::internal + ** \brief oln::morpho::fast::tarjan::internal namespace + */ namespace internal { - // attribute closing + /*! + ** \brief perform an attribute closing + ** + ** FIXME: ONLY A TEST + ** \code + ** #include <oln/basics2d.hh> + ** #include <oln/morpho/attribute_closing_opening.hh> + ** #include <oln/level/compare.hh> + ** #include <ntg/all.hh> + ** #include <iostream> + ** int main() + ** { + ** typedef oln::image2d<ntg::int_u8> im_type; + ** + ** im_type im1(oln::load(IMG_IN "lena256.pgm")); + ** im1 = oln::morpho::fast::area_closing(im1, oln::neighb_c4(), 200); + ** oln::save(im1, IMG_OUT "olena_attribute_closing_opening_hh_attr_clo.ppm"); + ** return 0; + ** } + ** \endcode + ** \image html lena256.png \image latex lena256.png => \image html olena_attribute_closing_opening_hh_attr_clo.png \image latex olena_attribute_closing_opening_hh_attr_clo.png + ** + */ template<class I, class N, class A> oln_concrete_type(I) attr_closing_(const abstract::non_vectorial_image<I>& input, Index: olena/oln/core/abstract/behavior.hh --- olena/oln/core/abstract/behavior.hh Tue, 10 Feb 2004 15:35:04 +0100 palma_g (oln/j/46_behavior.h 1.1 644) +++ olena/oln/core/abstract/behavior.hh Mon, 23 Feb 2004 17:32:31 +0100 palma_g (oln/j/46_behavior.h 1.1 644) @@ -31,24 +31,44 @@ # include <oln/core/abstract/image.hh> # include <oln/core/coord.hh> +/*! \namespace oln +** \brief oln namespace +*/ namespace oln { + /*! \namespace abstract + ** \brief abstract namespace + */ namespace abstract { - // behavior hierarchy - //the aim of this one is to describe how an algorithm should work - //on borders + + /*! \class behavior + ** behavior hierarchy + ** + ** the aim of this one is to describe how an algorithm should work + ** on borders + */ template <class Exact> class behavior: public mlc_hierarchy::any<Exact> { public: - typedef behavior<Exact> self_type; - typedef mlc_exact_vt_type(self_type, Exact) exact_type; + typedef behavior<Exact> self_type; /*!< the self type*/ + typedef mlc_exact_vt_type(self_type, Exact) exact_type; /*!< the exact type*/ + /*! + ** \brief Adapt the border of an image + ** + ** Adapt the border of an image regarding the kind of behavior wanted. + */ template <class I> void adapt_border(oln::abstract::image<I> &im, coord border_size) const { mlc_dispatch(adapt_border)(im, border_size); }; protected: + /*! + ** \brief CTor + ** + ** Do nothing, used only by sub-classes + */ behavior() {}; }; } // !abstract Index: olena/oln/core/behavior.hh --- olena/oln/core/behavior.hh Tue, 10 Feb 2004 15:35:04 +0100 palma_g (oln/j/47_behavior.h 1.1 644) +++ olena/oln/core/behavior.hh Tue, 24 Feb 2004 11:03:29 +0100 palma_g (oln/j/47_behavior.h 1.1 644) @@ -31,6 +31,10 @@ # include <mlc/type.hh> namespace oln { + /*! \class mirror_behavior + ** + ** make the border be a mirror of the image + */ // mirror the image content into the border template <class Exact = mlc::final> class mirror_behavior: Index: doc/ref/exdoc.pl --- doc/ref/exdoc.pl Tue, 24 Feb 2004 16:30:39 +0100 palma_g () +++ doc/ref/exdoc.pl Mon, 23 Feb 2004 19:58:25 +0100 palma_g (oln/v/26_exdoc.pl 1.2 755) @@ -0,0 +1,447 @@ +#! /usr/bin/perl -w +# Extract all examples from the manual source. + +# This program 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; either version 2 of the License, or +# (at your option) any later version. +# +# This program 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 this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +# 02111-1307 USA + +use strict; +use IO::File; +use Text::Wrap; +use File::Basename; +use Getopt::Long qw(GetOptions); +use Pod::Usage qw(pod2usage); + +## WARNING SOME PIECE OF CODE WORKING ON TEXI FILES SHOULD BE REMOVED +## BOFORE DOING THIS, MAKE SURE THE SAME JOB IS PERFORMED BY THE +## CONFIGURATION DEPENDANT WAY + +my $me = basename ($0); + +# Array of hash tables holding the information from the config file +my @config; + +# Print the usage method +sub print_usage() +{ + print "Usage:\n"; + print "$me --configfile=[cfg] --default-name=[default name] --srcdir=[dir to find includes file] --output-dir=[dir to put result]\n"; + exit(1); +} + +# &parse_config ($FILE) +# --------------------- +# Parse the config file. +sub parse_config($) +{ + open (CONFIGFILE, $_[0]) or die "$me: Can't open $_[0]: $!"; + + # Number of entries + my $entries = -1; + + while (<CONFIGFILE>) + { + if (/\[ENTRY\]/) { $entries++ } + else + { + SWITCH: + { + last SWITCH if (/^\s*(\#+.*)*$/); + $config[$entries]{"command_prefix"} = $1 and last SWITCH if (/\s*COMMAND_PREFIX\s*=\s*([^\#]*[^\s])\s*(\#+.*)*$/); + $config[$entries]{"tag_open"} = $1 and last SWITCH if (/\s*TAG_OPEN\s*=\s*([^\#]*[^\s])\s*(\#+.*)*$/); + $config[$entries]{"tag_close"} = $1 and last SWITCH if (/\s*TAG_CLOSE\s*=\s*([^\#]*[^\s])\s*(\#+.*)*$/); + $config[$entries]{"captions"} = $1 and last SWITCH if (/\s*CAPTIONS\s*=\s*([^\#]*[^\s])\s*(\#+.*)*$/); + $config[$entries]{"options"} = $1 and last SWITCH if (/\s*OPTIONS\s*=\s*([^\#]*[^\s])\s*(\#+.*)*$/); + $config[$entries]{"out"} = $1 and last SWITCH if (/\s*OUT\s*=\s*([^\#]*[^\s])\s*(\#+.*)*$/); + $config[$entries]{"std_out"} = $1 and last SWITCH if (/\s*STD_OUT_EXT\s*=\s*([^\#]*[^\s])\s*(\#+.*)*$/); + $config[$entries]{"err_out"} = $1 and last SWITCH if (/\s*ERR_OUT_EXT\s*=\s*([^\#]*[^\s])\s*(\#+.*)*$/); + $config[$entries]{"ext"} = $1 and last SWITCH if (/\s*EXT\s*=\s*([^\#]*[^\s])\s*(\#+.*)*$/); + $config[$entries]{"$1"} = $2 and last SWITCH if (/\s*ALIAS\s*([^\s]*)\s*=\s*([^\#]*[^\s])\s*(\#+.*)*$/); + $config[$entries]{"comment_style"} = $1 and last SWITCH if (/\s*COMMENT_STYLE\s*=\s*([^\#]*[^\s])\s*(\#+.*)*$/); + die "$0: Error: Unmatching entry: $_"; + } + } + } + close CONFIGFILE; + die "$me: Invalid config file `$_[0]'" if ($entries == -1); # FIXME: not strict enough. + + for (my $i = 0; $i < @config; $i++) + { + $config[$i]{"tag_open"} = $config[$i]{"command_prefix"} . $config[$i]{"tag_open"}; + $config[$i]{"tag_close"} = $config[$i]{"command_prefix"} . $config[$i]{"tag_close"}; + } + + for my $i ( 0 .. $#config ) + { + for my $role ( keys %{ $config[$i] } ) + { + print "elt $i $role is $config[$i]{$role}\n"; + } + } +} + +# get the real value of a field +# $i: the current entry number +# $name: the alias name +sub get_alias($ $) +{ + my ($i, $name) = @_; + while (defined($config[$i]{$name})) + { + $name = $config[$i]{$name}; + } + return $name; +} + +# create the cmd line to be executed +# $i: the current entry number +sub gen_cmd($ $) +{ + my ($i, $prog) = @_; + my $cmd = get_alias $i, $config[$i]{"captions"}; + $cmd = "$cmd ".$config[$i]{"options"}; + return $cmd." && ./$prog > $prog.".$config[$i]{"std_out"}." 2> $prog.".$config[$i]{"err_out"}."\nexit \$?\n"; +} + +# Dependencies of KEY as a simple string. +my %dependency; +# Set to 1 if KEY is not to keep as a dependency. +my %ignore; + +# &DEPEND ($TARGET, @DEPENDENCY) +# ------------------------------ +sub depend ($@) +{ + my ($target, @dependency) = @_; + @dependency = (grep { !exists $ignore{$_} } @dependency); + push @{$dependency{$target}}, @dependency + if @dependency; +} + +# List of files already opened. $FILE{FILE} is where FILE was +# first defined. +my %file; + +# ®ister ($FILE) +# ----------------- +# Make sure the $FILE name is used only once (as input or output), to +# avoid clashes. +sub register ($) +{ + my ($file2) = @_; + if (defined $file{$file2}) + { + die "$file2 already in use\n"; + } + $file{$file2} = $file2; +} + + +# example_to_verbatim(CODE) +# ------------------------- +# content: txt +# style: comment style +sub example_to_verbatim ($ $) +{ + my ($contents, $style) = @_; + + $contents =~ s/^\@(c |comment|dots|end (ignore|group)|ignore|group).*$//gm; + # Remove the Texinfo tags. + $contents =~ s/^\@(error|result)\{\}//gsm; + $contents =~ s/\@([{@}])/$1/gsm; + $contents =~ s/^\@comment.*//gm; + # remove the comment style sequence + $contents =~ s/^\s*$style//gm; + + return $contents; +} + + +# &REPORT (@MESSAGE) +# ------------------ +# Report some @MESSAGE to the user. +sub message (@) +{ + print STDERR "$me: ", @_, "\n"; +} + + +# &STORE ($FILE, $CONTENTS) +# ------------------------- +# Save the $CONTENTS in the $FILE, unless it already contains $WHAT. +sub store ($$) +{ + my ($file, $contents) = @_; + if (-f $file) + { + local $/; # Turn on slurp-mode. + my $f = new IO::File "< $file" + or die "$me: cannot open $file for reading: $!\n"; + my $old_contents = $f->getline; + if ($old_contents eq $contents) + { + message "$file: unchanged"; + return ; + } + } + my $out = new IO::File (">$file") + or die "$me: cannot create $file: $!\n"; + print $out $contents; + message "$file: new"; +} + +# The directory where to store the extracted results. +# Parse our options, trying to retain backwards compatibility with pod2man but +# allowing short forms as well. --lax is currently ignored. +my %option; +Getopt::Long::config ('bundling_override'); + +my $odir = "extract"; +my $idir = "."; +my $srcdir = "."; +my $default_name; +GetOptions (\%option, + 'configfile|c=s', +# 'default-name|n=s' => \$default_name, + 'srcdir|s=s' => \$srcdir, + 'input-dir|I=s' => \$idir, + 'output-dir|O=s' => \$odir, + 'help|h') or exit 1; +pod2usage (0) if $option{help}; + +#print_usage() unless (defined($default_name)); + +##my $default_name = $option{"default-name"}; ## | for auto generated file name +my $current_file_no; + + +if (! -d $odir) +{ + mkdir $odir or die "$me: cannot create $odir: $!\n"; +} +my $makefile = new IO::File "> $odir/makefile" + or die "$me: cannot create $odir/makefile: $!\n"; +my $all_mk = new IO::File "> $odir/all.mk" + or die "$me: cannot create $odir/all.mk: $!\n"; +print $makefile "include $srcdir/../exdoc.mk\n"; +print $makefile ".PHONY: all dvi eps html pdf txt\n"; +# print $makefile "all: txt\n"; +my $example; +my $last_file; + +parse_config ($option{"configfile"}); +print $all_mk "all:"; +print $makefile "include all.mk\n"; +for (my $i = 0; $i < @config; $i++) +{ + print $makefile "."; + print $makefile $config[$i]{"ext"}; + print $makefile ":\n\t"; + print $makefile "chmod 700 ./\$<.cmd "; + print $makefile "&& eval ./\$@."; + print $makefile $config[$i]{"ext"}; + print $makefile ".cmd \$< \$@"; + print $makefile "\n\n"; +} + +sub parse($) +{ + $current_file_no = 0; + open (FILE, $_[0]) or die "$me: Can't open $_[0]: $!"; + while (<FILE>) + { + ## @dotcaption{ord, file} + ## ====================== + if (/^\@dotcaption{([-.\w]+),\s*([^\}]+)}/) + { + my $ord = $1; + my $file = $2; + register $ord; + register $file; + store "$odir/$ord.file", "$file.dot"; + depend "html", "$ord.jpg"; + depend "pdf", "$ord.pdf"; + depend "txt", "$ord.txt"; + depend "dvi", "$ord.eps"; + } + + ## @example/@end example + ## ===================== + ## Memoize the contents. + else + { + my $i = 0; + + for ($i = 0; ($i < @config) + && not ((/^\s*$config[$i]{"comment_style"}\s*$config[$i]{"tag_open"}\s*$/ .. /^\s*$config[$i]{"comment_style"}\s*$config[$i]{"tag_close"}\s*$/)); $i++) + { + } + + if ($i < @config) + { + if (/^\s*$config[$i]{"comment_style"}\s*$config[$i]{"tag_open"}\s*$/) + { + # Nothing. + undef $example; + } + elsif (/^\s*$config[$i]{"comment_style"}\s*$config[$i]{"tag_close"}\s*$/) + { + my $fname; + my $cmdname; + my $ext = $config[$i]{"ext"}; + + $ext = ".$ext"; + if (not defined $last_file) + { + $last_file = "$default_name$current_file_no"; + $current_file_no = $current_file_no + 1; + } + # Output as a verbatim file. + $fname = "$odir/$last_file$ext"; + $cmdname = "$odir/$last_file$ext.cmd"; + register $fname; + register $cmdname; + store $fname, example_to_verbatim ($example, $config[$i]{"comment_style"}); + store $cmdname, gen_cmd ($i, $last_file); + depend $last_file, "$last_file$ext", "$last_file$ext.cmd"; + print $all_mk "$last_file "; + undef $last_file; + } + ## @filecaption{ord, filename} + ## Outputting the previous @example as a file. + elsif (/^\s*$config[$i]{"comment_style"}\s*$config[$i]{"command_prefix"}filecaption{([-.\w]+),\s*([^\}]+)}/) + { + my ($ord, $file) = ($1, "$2"); +# register $file; + $last_file = $file; + } + else + { + $example = $example . $_; + } + } + + + ## @c extdoc-ignore: file + ## ## A file that we should not depend upon (e.g., it does not exist). + elsif (/^\@c extdoc-ignore: (.*)$/) + { + message "ignoring $1"; + $ignore{$1} = 1; + } + + + ## @havmcaption{ord, args} + ## @mipsycaption{ord, args} + ## @tccaption{ord, args} + ## @sedcaption{ord, args} + ## ## Running `havm', `mipsy', `tc', or `sed' on the ARGS. + else + { + my $i = 0; + for ($i = 0; ($i < @config) && + not (/^\s*$config[$i]{"comment_style"}\s*$config[$i]{"command_prefix"}($config[$i]{"captions"})caption{([-.\w]+),\s*([^\}]+)}/); $i++) + {} + if ($i < @config && /^\s*$config[$i]{"comment_style"}\s*$config[$i]{"command_prefix"}($config[$i]{"captions"})caption{([-.\w]+),\s*([^\}]+)}/) + { + my $prog; + + + if (defined $config[$i]{$1}) + { + $prog = $config[$i]{$1}; + + print $prog; + } + else + { + $prog = $1; + } + my $ord = $2; + my $args = $3; + my $out = "$ord.$config[$i]{out}"; +# register $out; + store "$odir/$ord.cmd", "$prog $args"; + depend "pdf", $out; + depend "html", $out; + depend "txt", $out; + depend "dvi", $out; + + # Dependencies: args except options and output redirections. + depend $out, grep { !/^[->]/ } split (' ', $args); + } + } + } + } + close FILE; +} +# go through all rep and sub rep and make stuff on matching file +sub scanDir +{ + my $file; + my ($d, $name) = @_;#$_[0]; + opendir DIR, "$d" or print <STDERR>, "unable to open $d: skipping\n"; + foreach $file(readdir DIR) + { + if ((-d "$d/$file") && ($file ne ".") && ($file ne "..")) + { + &scanDir("$d/$file", "$name"."_$file"); + } + else + { + if ($file =~ /(.*)\.(h(h|xx)|cc|inc)$/) + { + $file = "$file"; +# compileAndExecute("$d/$file"); + print "parsing $d/$file as "; + print "$name"."_$1_$2\n"; + $default_name = "$name"."_$1_$2"; + + parse "$d/$file"; + } + } + } + # closedir DIR or print("unable to close $d: skipping\n"); # to be fixed +} + +scanDir $idir, "out"; + +for my $target (sort keys %dependency) +{ + print $makefile "$target: "; + my @dep = @{$dependency{$target}}; + for (my $k=0; $k != $#dep; $k++) + { + print $makefile " ".$dep[$k]; + } + print $makefile "\n"; +} +print $all_mk "\n"; +### Setup "GNU" style for perl-mode and cperl-mode. +## Local Variables: +## perl-indent-level: 2 +## perl-continued-statement-offset: 2 +## perl-continued-brace-offset: 0 +## perl-brace-offset: 0 +## perl-brace-imaginary-offset: 0 +## perl-label-offset: -2 +## cperl-indent-level: 2 +## cperl-brace-offset: 0 +## cperl-continued-brace-offset: 0 +## cperl-label-offset: -2 +## cperl-extra-newline-before-brace: t +## cperl-merge-trailing-else: nil +## cperl-continued-statement-offset: 2 +## End: + Index: doc/ref/doxygen.config.in --- doc/ref/doxygen.config.in Tue, 24 Feb 2004 16:30:39 +0100 palma_g () +++ doc/ref/doxygen.config.in Tue, 24 Feb 2004 13:33:45 +0100 palma_g (oln/v/29_doxygen.co 1.1 644) @@ -0,0 +1,214 @@ +# Doxyfile 1.3.2 + +#--------------------------------------------------------------------------- +# General configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = @PACKAGE_NAME@ +PROJECT_NUMBER = @PACKAGE_VERSION@ +OUTPUT_DIRECTORY = . +OUTPUT_LANGUAGE = English +USE_WINDOWS_ENCODING = NO +EXTRACT_ALL = NO +EXTRACT_PRIVATE = NO +EXTRACT_STATIC = YES +EXTRACT_LOCAL_CLASSES = NO +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ALWAYS_DETAILED_SEC = NO +INLINE_INHERITED_MEMB = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +INTERNAL_DOCS = NO +CASE_SENSE_NAMES = NO +SHORT_NAMES = NO +HIDE_SCOPE_NAMES = NO +SHOW_INCLUDE_FILES = YES +JAVADOC_AUTOBRIEF = NO +MULTILINE_CPP_IS_BRIEF = NO +DETAILS_AT_TOP = NO +INHERIT_DOCS = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +DISTRIBUTE_GROUP_DOC = NO +TAB_SIZE = 8 +GENERATE_TODOLIST = YES +GENERATE_TESTLIST = YES +GENERATE_BUGLIST = YES +GENERATE_DEPRECATEDLIST= YES +ALIASES = pouetcaption= +ENABLED_SECTIONS = +MAX_INITIALIZER_LINES = 30 +OPTIMIZE_OUTPUT_FOR_C = NO +OPTIMIZE_OUTPUT_JAVA = NO +SHOW_USED_FILES = YES +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_FORMAT = "$file:$line: $text" +WARN_LOGFILE = +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = @top_srcdir@/ +FILE_PATTERNS = *.hh \ + *.hxx \ + *.cc +RECURSIVE = YES +EXCLUDE = @top_srcdir@/doc \ + @top_srcdir@/olena/tests \ + @top_srcdir@/integre/tests \ + @top_srcdir@/metalic/tests +EXCLUDE_SYMLINKS = NO +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +EXAMPLE_RECURSIVE = NO +IMAGE_PATH = @top_builddir@doc/ref/img/ +INPUT_FILTER = +FILTER_SOURCE_FILES = NO +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = YES +INLINE_SOURCES = YES +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = YES +REFERENCES_RELATION = YES +VERBATIM_HEADERS = YES +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 5 +IGNORE_PREFIX = +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = html +HTML_FILE_EXTENSION = .html +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = NO +CHM_FILE = +HHC_LOCATION = +GENERATE_CHI = NO +BINARY_TOC = NO +TOC_EXPAND = NO +DISABLE_INDEX = NO +ENUM_VALUES_PER_LINE = 4 +GENERATE_TREEVIEW = YES +TREEVIEW_WIDTH = 250 +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- +GENERATE_LATEX = YES +LATEX_OUTPUT = latex +LATEX_CMD_NAME = latex +MAKEINDEX_CMD_NAME = makeindex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = YES +USE_PDFLATEX = YES +LATEX_BATCHMODE = NO +LATEX_HIDE_INDICES = NO +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 +MAN_LINKS = NO +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- +GENERATE_XML = NO +XML_OUTPUT = xml +XML_SCHEMA = +XML_DTD = +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- +GENERATE_AUTOGEN_DEF = NO +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- +GENERATE_PERLMOD = NO +PERLMOD_LATEX = NO +PERLMOD_PRETTY = YES +PERLMOD_MAKEVAR_PREFIX = +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +INCLUDE_PATH = @top_srcdir@/olena/ \ + @top_srcdir@/integre/ \ + @top_srcdir@/metalic/ +INCLUDE_FILE_PATTERNS = +PREDEFINED = +EXPAND_AS_DEFINED = +SKIP_FUNCTION_MACROS = YES +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- +TAGFILES = +GENERATE_TAGFILE = +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +PERL_PATH = /usr/bin/perl +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = YES +HIDE_UNDOC_RELATIONS = YES +HAVE_DOT = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +UML_LOOK = YES +TEMPLATE_RELATIONS = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +CALL_GRAPH = NO +GRAPHICAL_HIERARCHY = YES +DOT_IMAGE_FORMAT = png +DOT_PATH = +DOTFILE_DIRS = +MAX_DOT_GRAPH_WIDTH = 1024 +MAX_DOT_GRAPH_HEIGHT = 1024 +MAX_DOT_GRAPH_DEPTH = 0 +GENERATE_LEGEND = YES +DOT_CLEANUP = YES +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- +SEARCHENGINE = YES +CGI_NAME = search.cgi +CGI_URL = +DOC_URL = +DOC_ABSPATH = +BIN_ABSPATH = /usr/local/bin/ +EXT_DOC_PATHS = Index: doc/ref/exdoc.mk.in --- doc/ref/exdoc.mk.in Tue, 24 Feb 2004 16:30:39 +0100 palma_g () +++ doc/ref/exdoc.mk.in Mon, 29 Sep 2003 21:50:01 +0200 palma_g (oln/k/1_exdoc.mk.i 644) @@ -0,0 +1,56 @@ +%.dot: %.file + cp $$(cat $<) $@ + +%.texi: %.cmd +## Eval the cmd to preserve embedded redirections. + eval $$(cat $<) >$*.out 2>$*.err; \ + echo $$? >$*.sta + rm -f $@ + echo '@example' >> $@ + echo "$$ @kbd{$$(cat $<)}" >> $@ + if test -s $*.err; then \ + sed -n -e 's/\([{@}]\)/@\1/g' \ + -e '/./s/.*/@error{}&/p' $*.err >> $@;\ + fi + if test -s $*.out; then \ + expand $*.out | \ + sed -e 's/\([{@}]\)/@\1/g' \ + -e "s/é/@'e/g" \ + -e 's/è/@`e/g' \ + -e 's/ê/@^e/g' \ + -e 's/ë/@"e/g' \ + -e 's/î/@^i/g' \ + -e 's/ï/@"i/g' \ + -e 's/ô/@^o/g' \ + >>$@;\ + fi +## Display the exit status only if not 0, as it confuses the +## students to see so many `=> 0'. But, if there is nothing output +## at all, it is even more confusing, so output `=> 0' only when +## needed. + if test ! -e $@ \ + || test $$(cat $*.sta) -ne 0; then \ + sed 's/.*/@result{}&/' $*.sta >> $@; \ + fi + echo "@strong{Example $*}: @kbd{$$(cat $<)}" >> $@ + echo '@end example' >> $@ + +## Once for PDF. +## ratio = 2 makes it wider. +## size (in Inches) makes it fit into A4. +%.eps: %.dot + dot -Gratio=2 -Gsize=8,8 -Tps2 $*.dot -o $*.ps + ps2epsi $*.ps $*.eps + +%.pdf: %.eps + epstopdf $*.eps -o $*.pdf + +## Another for HTML (JPG), using natural size. +%.jpg: %.dot + dot -Tps2 $*.dot -o $*.j.ps + ps2epsi $*.j.ps $*.j.eps + convert $*.j.eps $*.jpg + +## And the text... +%.txt: %.dot + cp $< $@ Index: doc/ref/exdoc.config.in --- doc/ref/exdoc.config.in Tue, 24 Feb 2004 16:30:39 +0100 palma_g () +++ doc/ref/exdoc.config.in Tue, 24 Feb 2004 15:01:50 +0100 palma_g (oln/k/2_exdoc.conf 644) @@ -0,0 +1,12 @@ +[ENTRY] + COMMAND_PREFIX = \\ # In Doxygen, commands begin with a `\' + TAG_OPEN = code + TAG_CLOSE = endcode + CAPTIONS = cxx # We want to run cxx on the extracted files (see line below) + ALIAS cxx = @CXX@ # Here, cxx means g++ but you can choose other compilers + OPTIONS = @CXXFLAGS@ -I@top_srcdir@/integre -I@top_srcdir@/olena -I@top_srcdir@/metalic $1 -o $2 -DIMG_OUT=\"../img/\" -DIMG_IN=\"@top_srcdir@/olena/img/\" # tell how to use the soft, i.e. where to put input and output arguments (default if not overriden) ($1: input, $2: output) FIXME: $* should have explicit name, chek flags + OUT = out # FIXME: should be obsolete + EXT = cc # Extension of generated file + STD_OUT_EXT = std # Extension of generated file standard output + ERR_OUT_EXT = err # Extension of generated file error output + COMMENT_STYLE = \*\* # begining of comment line Index: doc/ref/img_conv.pl --- doc/ref/img_conv.pl Tue, 24 Feb 2004 16:30:39 +0100 palma_g () +++ doc/ref/img_conv.pl Tue, 24 Feb 2004 15:57:37 +0100 palma_g (oln/k/3_img_conv.p 644) @@ -0,0 +1,47 @@ +#! /usr/bin/perl -w +# This program 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; either version 2 of the License, or +# (at your option) any later version. +# +# This program 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 this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +# 02111-1307 USA + + +use strict; +use IO::File; +use Text::Wrap; +use File::Basename; +use Getopt::Long qw(GetOptions); +use Pod::Usage qw(pod2usage); + + +sub conv($ $) +{ + my $file; + my $d = $_[0]; + my $o = $_[1]; + opendir DIR, "$d" or die "Unable to open $d.\n"; + foreach $file(readdir DIR) + { + if ($file =~ /(.*)\.(pgm|ppm|ppgm|pppgm)$/) + { + print "convert $d/$file to $o/$1.png\n"; + system "convert $d/$file $o/$1.png"; + } + } + closedir DIR or die "unable to close $d."; +} +my $argc=@ARGV; +if ($argc != 2) +{ + die "usage: img_conv.pl input-dir output-dir\n"; +} +conv $ARGV[0], $ARGV[1]; -- Giovanni Palma EPITA - promo 2005 - membre d'EpX - LRDE Mob. : +33 (0)6 60 97 31 74