proto-1.0 22: Documentation generation

Index: ChangeLog from Simon Odou <simon@lrde.epita.fr> * ref/doxygen.config.in: New. Doxygen configuration file (from Olena). * ref/out: New. * ref/out/exdoc.config.in: New. Exdoc configuration (from Olena). * ref/Makefile.am: Use exdoc to generate documentation. * ref/img_conv.pl: New. Image conversion script (from Olena). * ref/exdoc.pl: New. Exdoc to write examples in documentation (from Olena). * ref/exdoc.mk.in: New. Makefile for exdoc (from Olena). * vcs: New. Add vcs support for this ChangeLog. * vcs/oln.rb: New. Likewise. ref/Makefile.am | 19 +- ref/doxygen.config.in | 210 ++++++++++++++++++++++ ref/exdoc.mk.in | 56 +++++ ref/exdoc.pl | 450 ++++++++++++++++++++++++++++++++++++++++++++++++ ref/img_conv.pl | 61 ++++++ ref/out/exdoc.config.in | 13 + vcs/oln.rb | 13 + 7 files changed, 819 insertions(+), 3 deletions(-) Index: ChangeLog Index: vcs/oln.rb --- vcs/oln.rb (revision 0) +++ vcs/oln.rb (revision 0) @@ -0,0 +1,13 @@ +class Vcs + + def oln_commit! ( s, *args ) + + common_commit!(*args) do |rev| + news!(:groups => ['lrde.olena.patches'], + :subject => "proto-1.0 #{rev}: #{s}") + end + + end + alias_command :olnci, :oln_commit + +end # class Vcs Index: ref/doxygen.config.in --- ref/doxygen.config.in (revision 0) +++ ref/doxygen.config.in (revision 0) @@ -0,0 +1,210 @@ +# 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@/olena \ + @top_srcdir@/integre \ + @top_srcdir@/metalic +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 = YES +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 = NO +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 Index: ref/out/exdoc.config.in --- ref/out/exdoc.config.in (revision 0) +++ ref/out/exdoc.config.in (revision 0) @@ -0,0 +1,13 @@ +[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 + # FIXME: we should write the compilation line in the source file (for libs). + OPTIONS = @DOC_CPPFLAGS@ @CXXFLAGS_OPTIMIZE@ @CXXFLAGS_STRICT_ERRORS@ -I@top_srcdir@/integre -I@top_builddir@/olena -I@top_srcdir@/olena -I@top_srcdir@/metalic -I@top_builddir@ $1 -o $2 -DIMG_OUT=\"../img/\" -DIMG_IN=\"@top_srcdir@/olena/img/\" -DHAVE_CONFIG_H @TOOLS_LDFLAGS@ # 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: ref/Makefile.am --- ref/Makefile.am (revision 21) +++ ref/Makefile.am (working copy) @@ -6,14 +6,18 @@ include $(top_srcdir)/integre/ntg/makefile.src olnsrc = $(top_srcdir)/olena/oln -OUT_DIR = "out" +EXDOC = $(srcdir)/exdoc.pl +OUT_DIR = out +EXTRA_DIST = $(OUT_DIR)/exdoc.config.in +IMG_CONV = $(srcdir)/img_conv.pl CLEANFILES = html.tar.gz \ oln-ref.pdf \ - out/out* out/makefile out/all.mk + $(OUT_DIR)/out* $(OUT_DIR)/makefile $(OUT_DIR)/all.mk clean-local: rm -rf img html latex +DISTCLEANFILES = $(OUT_DIR)/exdoc.config MAINTAINERCLEANFILES = $(dist_noinst_DATA) \ ./html/* ./img/* @@ -25,7 +29,16 @@ doc: html.tar.gz oln-ref.pdf -html.tar.gz: $(HDRS_DEP) +html.tar.gz: $(HDRS_DEP) $(EXDOC) $(OUT_DIR)/exdoc.config $(IMG_CONV) doxygen.config + mkdir -p img + $(EXDOC) --config=$(OUT_DIR)/exdoc.config --output-dir=$(OUT_DIR) --input-dir=$(top_srcdir)/olena + cd $(OUT_DIR) && $(MAKE) -f makefile + $(EXDOC) --config=$(OUT_DIR)/exdoc.config --output-dir=$(OUT_DIR) --input-dir=$(top_srcdir)/integre + cd $(OUT_DIR) && $(MAKE) -f makefile + $(EXDOC) --config=$(OUT_DIR)/exdoc.config --output-dir=$(OUT_DIR) --input-dir=$(top_srcdir)/metalic + cd $(OUT_DIR) && $(MAKE) -f makefile + $(IMG_CONV) $(top_srcdir)/olena/img img preserve + $(IMG_CONV) img img nopreserve $(DOXYGEN) doxygen.config $(TAR) -czf $@ html Index: ref/img_conv.pl --- ref/img_conv.pl (revision 0) +++ ref/img_conv.pl (revision 0) @@ -0,0 +1,61 @@ +#! /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]; + my $preserve_name = 0; + if ($_[2] =~ /^preserve$/) + { + $preserve_name = 1; + } + + opendir DIR, "$d" or die "Unable to open $d.\n"; + foreach $file(readdir DIR) + { + if ($file =~ /(.*)\.(pgm|ppm|ppgm|pppgm|pbm)$/) + { + if ($preserve_name == 1) + { + print "convert $d/$file to $o/$1_$2.png\n"; + system "convert $d/$file $o/$1_$2.png"; + } + else + { + 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 != 3) +{ + die "usage: img_conv.pl input-dir output-dir preserve|nopreserve\n"; +} +conv $ARGV[0], $ARGV[1], $ARGV[2]; Property changes on: ref/img_conv.pl ___________________________________________________________________ Name: svn:executable + * Index: ref/exdoc.pl --- ref/exdoc.pl (revision 0) +++ ref/exdoc.pl (revision 0) @@ -0,0 +1,450 @@ +#! /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"}; + $cmd = $cmd." && ./$prog > $prog.".$config[$i]{"std_out"}." 2> $prog."; + $cmd = $cmd.$config[$i]{"err_out"}."\nret=\$?\n"; + $cmd = $cmd. "if [ \$ret -ne 0 ]\n then\n rm \$2\nfi\nexit \$ret\n"; + return $cmd; +} + +# 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: + Property changes on: ref/exdoc.pl ___________________________________________________________________ Name: svn:executable + * Index: ref/exdoc.mk.in --- ref/exdoc.mk.in (revision 0) +++ ref/exdoc.mk.in (revision 0) @@ -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 $< $@

Simon Odou <simon@lrde.epita.fr> writes: [...]
--- ref/doxygen.config.in (revision 0) +++ ref/doxygen.config.in (revision 0) [...] +ALIASES = pouetcaption= je suis pas sur que ca serve a qqc, faudrait frapper celui qui l'a integre dans olena.
[...]
+PERL_PATH = /usr/bin/perl ca ne devrait pas venir des autochoses ca ?
[...] -- Giovanni Palma EPITA - promo 2005 - LRDE Mob. : +33 (0)6 60 97 31 74

Giovanni Palma <giovanni@lrde.epita.fr> writes:
Simon Odou <simon@lrde.epita.fr> writes:
[...]
--- ref/doxygen.config.in (revision 0) +++ ref/doxygen.config.in (revision 0) [...] +ALIASES = pouetcaption= je suis pas sur que ca serve a qqc, faudrait frapper celui qui l'a integre dans olena.
[...]
+PERL_PATH = /usr/bin/perl ca ne devrait pas venir des autochoses ca ?
[...]
C'est corrigé. -- Simon Odou simon@lrde.epita.fr
participants (2)
-
Giovanni Palma
-
Simon Odou