Olena
Threads by month
- ----- 2025 -----
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
September 2003
- 8 participants
- 23 discussions
First attempt:
--------------
$ autoconf --version
autoconf (GNU Autoconf) 2.57c
$ autoreconf -ifv
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal -I config --output=aclocal.m4t
autoreconf: `aclocal.m4' is unchanged
autoreconf: configure.ac: tracing
configure.ac:422: /usr/bin/m4: Warning: Excess arguments to built-in `m4_pushdef' ignored
autom4te: /usr/bin/m4 failed with exit status: 1
autoreconf: configure.ac: not using Libtool
autoreconf: running: /usr/local/bin/autoconf --force
configure.ac:422: /usr/bin/m4: Warning: Excess arguments to built-in `m4_pushdef' ignored
autom4te: /usr/bin/m4 failed with exit status: 1
autoreconf: /usr/local/bin/autoconf failed with exit status: 1
Second attenpt:
---------------
$ autoconf --version
autoconf (GNU Autoconf) 2.57
$ autoreconf -ifv
[...]
automake: cannot open < doc/ref/filelists.make: No such file or directory
and then:
automake: cannot open < tools/swilena/ruby/makefile.swig: No such file
or directory
automake: cannot open < tools/swilena/src/makefile.swig: No such file
or directory
--
astrid
3
3
Index: doc/ChangeLog
from Giovanni Palma <palma_g@headache>
* ref/exdoc.pl: Correct the regexps.
* ref/exdoc.config: Add comment style entry.
Index: doc/ref/exdoc.pl
--- doc/ref/exdoc.pl Mon, 29 Sep 2003 21:50:01 +0200 astrid (oln/v/26_exdoc.pl 1.1 755)
+++ doc/ref/exdoc.pl Mon, 29 Sep 2003 23:01:53 +0200 palma_g (oln/v/26_exdoc.pl 1.1 755)
@@ -53,7 +53,7 @@
$config[$entries]{"captions"} = $1 and last SWITCH if (/\s*CAPTIONS\s*=\s*([^\#]*[^\s])\s*(\#+.*)*$/);
$config[$entries]{"out"} = $1 and last SWITCH if (/\s*OUT\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: $_";
}
}
@@ -111,15 +111,17 @@
# example_to_verbatim(CODE)
# -------------------------
# Strip Texinfo markup.
-sub example_to_verbatim ($)
+sub example_to_verbatim ($ $)
{
- my ($contents) = @_;
+ 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/^\(a)comment.*//gm;
+ # remove the comment style sequence
+ $contents =~ s/^$style//gm;
return $contents;
}
@@ -210,32 +212,30 @@
{
my $i = 0;
- print $_;
for ($i = 0; ($i < @config)
- && not ((/^\s*$config[$i]{"tag_open"}\s*$/ .. /^\s*$config[$i]{"tag_close"}\s*$/)); $i++)
+ && 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)
{
- print "PASSEJAMAISLA\n";
- if (/^\s*$config[$i]{"tag_open"}\s*$/)
+ if (/^\s*$config[$i]{"comment_style"}\s*$config[$i]{"tag_open"}\s*$/)
{
# Nothing.
undef $example;
}
- elsif (/^\s*$config[$i]{"tag_close"}\s*$/)
+ elsif (/^\s*$config[$i]{"comment_style"}\s*$config[$i]{"tag_close"}\s*$/)
{
if (defined $last_file)
{
# Output as a verbatim file.
- store "$odir/$last_file", example_to_verbatim ($example);
+ store "$odir/$last_file", example_to_verbatim ($example, $config[$i]{"comment_style"});
undef $last_file;
}
}
## @filecaption{ord, filename}
## Outputting the previous @example as a file.
- elsif (/^\s*$config[$i]{"command_prefix"}filecaption{([-.\w]+),\s*([^\}]+)}/)
+ elsif (/^\s*$config[$i]{"comment_style"}\s*$config[$i]{"command_prefix"}filecaption{([-.\w]+),\s*([^\}]+)}/)
{
my ($ord, $file) = ($1, "$2");
register $file;
@@ -266,12 +266,9 @@
{
my $i = 0;
for ($i = 0; ($i < @config) &&
-# not (/^\s*$config[$i]{"command_prefix"}($config[$i]{"captions"})caption{([-.\w]+),\s*([^\}]+)}/); $i++)
- not (/^\s*\\cxxcaption{([-.\w]+),\s*([^\}]+)}/); $i++)
+ not (/^\s*$config[$i]{"comment_style"}\s*$config[$i]{"command_prefix"}($config[$i]{"captions"})caption{([-.\w]+),\s*([^\}]+)}/); $i++)
{}
-# FIXME: What's wrong with these regexp?
-# if ($i < @config && /^\s*$config[$i]{"command_prefix"}($config[$i]{"captions"})caption{([-.\w]+),\s*([^\}]+)}/)
- if ($i < @config && /^\s*\\(cxx)caption{([-.\w]+),\s*([^\}]+)}/)
+ if ($i < @config && /^\s*$config[$i]{"comment_style"}\s*$config[$i]{"command_prefix"}($config[$i]{"captions"})caption{([-.\w]+),\s*([^\}]+)}/)
{
my $prog;
Index: doc/ref/exdoc.config
--- doc/ref/exdoc.config Mon, 29 Sep 2003 21:50:01 +0200 astrid (oln/v/28_exdoc.conf 1.1 664)
+++ doc/ref/exdoc.config Mon, 29 Sep 2003 22:53:38 +0200 palma_g (oln/v/28_exdoc.conf 1.1 664)
@@ -1,7 +1,8 @@
[ENTRY]
- COMMAND_PREFIX = \ # In Doxygen, commands begin with a `\'
+ 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 = g++ # Here, cxx means g++ but you can choose other compilers
- OUT = texi # FIXME: should be obsolete
+ OUT = out # FIXME: should be obsolete
+ COMMENT_STYLE = \*\* # begining of comment line
\ No newline at end of file
--
Giovanni Palma
EPITA - promo 2005 - membre d'EpX - LRDE
Mob. : +33 (0)6 60 97 31 74
1
0
Still numerous FIXMES.
Index: ChangeLog
from Astrid Wang <astrid(a)lrde.epita.fr>
* configure.ac: Check for doxygen.
Index: doc/ChangeLog
from Astrid Wang <astrid(a)lrde.epita.fr>
* ref/exdoc.pl,
* ref/exdoc.config,
* ref/exdoc.mk: New.
* ref/doxygen.config.in: New.
Index: configure.ac
--- configure.ac Mon, 15 Sep 2003 17:23:46 +0200 burrus_n (oln/3_configure. 1.47.1.1.1.1.1.4.1.15.1.10 640)
+++ configure.ac Mon, 29 Sep 2003 16:53:58 +0200 astrid (oln/3_configure. 1.47.1.1.1.1.1.4.1.15.1.10 640)
@@ -231,6 +231,16 @@
### 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/configfile.in])
+## fi
+
### The documentation tree is both a component...
OLN_COMPONENT([doc],
Index: doc/ref/exdoc.pl
--- doc/ref/exdoc.pl Mon, 29 Sep 2003 21:48:17 +0200 astrid ()
+++ doc/ref/exdoc.pl Mon, 29 Sep 2003 19:30:04 +0200 astrid (oln/v/26_exdoc.pl 644)
@@ -0,0 +1,334 @@
+#! /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);
+
+my $me = basename ($0);
+
+# Array of hash tables holding the information from the config file
+my @config;
+
+# &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]{"out"} = $1 and last SWITCH if (/\s*OUT\s*=\s*([^\#]*[^\s])\s*(\#+.*)*$/);
+ $config[$entries]{"$1"} = $2 and last SWITCH if (/\s*ALIAS\s*([^\s]*)\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";
+ }
+ }
+}
+
+# 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 ($file) = @_;
+ die "$me: $.: $file already used in $file{$file}"
+ if $file{$file};
+ $file{$file} = "$ARGV:$.";
+}
+
+
+# example_to_verbatim(CODE)
+# -------------------------
+# Strip Texinfo markup.
+sub example_to_verbatim ($)
+{
+ my ($contents) = @_;
+
+ $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/^\(a)comment.*//gm;
+
+ return $contents;
+}
+
+
+# &REPORT (@MESSAGE)
+# ------------------
+# Report some @MESSAGE to the user.
+sub message (@)
+{
+ print STDERR "$me: $ARGV:$.: ", @_, "\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');
+GetOptions (\%option,
+ 'configfile|c=s',
+ 'srcdir|s=s',
+ 'output-dir|O=s',
+ 'help|h') or exit 1;
+pod2usage (0) if $option{help};
+
+my $odir = $option{"output-dir"} || "extract";
+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";
+print $makefile "include $option{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"});
+
+while (<>)
+{
+ ## @dotcaption{ord, file}
+ ## ======================
+ if (/^\(a)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;
+
+ print $_;
+ for ($i = 0; ($i < @config)
+ && not ((/^\s*$config[$i]{"tag_open"}\s*$/ .. /^\s*$config[$i]{"tag_close"}\s*$/)); $i++)
+ {
+ }
+
+ if ($i < @config)
+ {
+ print "PASSEJAMAISLA\n";
+ if (/^\s*$config[$i]{"tag_open"}\s*$/)
+ {
+ # Nothing.
+ undef $example;
+ }
+ elsif (/^\s*$config[$i]{"tag_close"}\s*$/)
+ {
+ if (defined $last_file)
+ {
+ # Output as a verbatim file.
+ store "$odir/$last_file", example_to_verbatim ($example);
+ undef $last_file;
+ }
+ }
+ ## @filecaption{ord, filename}
+ ## Outputting the previous @example as a file.
+ elsif (/^\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]{"command_prefix"}($config[$i]{"captions"})caption{([-.\w]+),\s*([^\}]+)}/); $i++)
+ not (/^\s*\\cxxcaption{([-.\w]+),\s*([^\}]+)}/); $i++)
+ {}
+# FIXME: What's wrong with these regexp?
+# if ($i < @config && /^\s*$config[$i]{"command_prefix"}($config[$i]{"captions"})caption{([-.\w]+),\s*([^\}]+)}/)
+ if ($i < @config && /^\s*\\(cxx)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);
+ }
+ }
+ }
+}
+
+
+for my $target (sort keys %dependency)
+{
+ ## print $makefile ".PHONY: $target\n";
+ # Using "map" only to get some functional composition of s///,
+ # but there is a single string here.
+ print $makefile (map ({ s/$(?!\z)/ \\/gm; $_ }
+ wrap ("$target: ",
+ " " x length ("$target: "),
+ @{$dependency{$target}})),
+ "\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/exdoc.mk
--- doc/ref/exdoc.mk Mon, 29 Sep 2003 21:48:17 +0200 astrid ()
+++ doc/ref/exdoc.mk Mon, 29 Sep 2003 16:28:00 +0200 astrid (oln/v/27_exdoc.mk 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
--- doc/ref/exdoc.config Mon, 29 Sep 2003 21:48:17 +0200 astrid ()
+++ doc/ref/exdoc.config Mon, 29 Sep 2003 19:34:41 +0200 astrid (oln/v/28_exdoc.conf 644)
@@ -0,0 +1,7 @@
+[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 = g++ # Here, cxx means g++ but you can choose other compilers
+ OUT = texi # FIXME: should be obsolete
Index: doc/ref/doxygen.config.in
--- doc/ref/doxygen.config.in Mon, 29 Sep 2003 21:48:17 +0200 astrid ()
+++ doc/ref/doxygen.config.in Fri, 26 Sep 2003 13:02:40 +0200 astrid (oln/v/29_doxygen.co 644)
@@ -0,0 +1,209 @@
+# 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/oln/
+FILE_PATTERNS = *.hh \
+ *.hxx \
+ *.cc
+RECURSIVE = YES
+EXCLUDE =
+EXCLUDE_SYMLINKS = NO
+EXCLUDE_PATTERNS =
+EXAMPLE_PATH =
+EXAMPLE_PATTERNS =
+EXAMPLE_RECURSIVE = NO
+IMAGE_PATH =
+INPUT_FILTER =
+FILTER_SOURCE_FILES = NO
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER = NO
+INLINE_SOURCES = NO
+STRIP_CODE_COMMENTS = YES
+REFERENCED_BY_RELATION = YES
+REFERENCES_RELATION = YES
+VERBATIM_HEADERS = YES
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX = NO
+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 = NO
+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 = NO
+EXPAND_ONLY_PREDEF = NO
+SEARCH_INCLUDES = YES
+INCLUDE_PATH =
+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 = NO
+CGI_NAME = search.cgi
+CGI_URL =
+DOC_URL =
+DOC_ABSPATH =
+BIN_ABSPATH = /usr/local/bin/
+EXT_DOC_PATHS =
--
astrid
1
0
Index: tools/swilena/ChangeLog
from Nicolas Burrus <burrus_n(a)lrde.epita.fr>
* meta/swilena_image.i: Add operator[] for python and ruby.
* meta/swilena_describe.i: Fix __str__ return type.
Index: tools/swilena/meta/swilena_image.i
--- tools/swilena/meta/swilena_image.i Sun, 21 Sep 2003 21:59:21 +0200 burrus_n (oln/s/36_swilena_im 1.4 640)
+++ tools/swilena/meta/swilena_image.i Sat, 27 Sep 2003 18:32:13 +0200 burrus_n (oln/s/36_swilena_im 1.5 640)
@@ -30,6 +30,13 @@
{ (*self)[p] = v; return *self; }
Val& ref(const point ## Dim ## d& p)
{ return (*self)[p]; }
+
+#if defined(SWIGPYTHON) || defined(SWIGRUBY)
+ Val __getitem__(const point ## Dim ## d& p)
+ { return (*self)[p]; }
+ T& __setitem__(const point ## Dim ## d& p, Val v)
+ { (*self)[p] = v; return *self; }
+#endif
}
EXTEND_DESCRIBE(T)
@@ -39,6 +46,12 @@
Val& operator()(coord);
%extend {
+#if defined(SWIGRUBY)
+ Val __getitem__(coord x)
+ { return (*self)(x); }
+ T __setitem__(coord x, Val v)
+ { (*self)(x) = v; return *self; }
+#endif
Val at(coord x) { return (*self)(x); }
T& set(coord x, Val v) { (*self)(x) = v; return *self; }
Val& ref(coord x) { return (*self)(x); }
@@ -49,6 +62,12 @@
Val& operator()(coord, coord);
%extend {
+#if defined(SWIGRUBY)
+ Val __getitem__(coord x, coord y)
+ { return (*self)(x, y); }
+ T __setitem__(coord x, coord y, Val v)
+ { (*self)(x, y) = v; return *self; }
+#endif
Val at(coord x, coord y)
{ return (*self)(x, y); }
T& set(coord x, coord y, Val v)
@@ -62,6 +81,12 @@
Val& operator()(coord, coord, coord);
%extend {
+#if defined(SWIGRUBY)
+ Val __getitem__(coord x, coord y, coord z)
+ { return (*self)(x, y, z); }
+ T __setitem__(coord x, coord y, coord z, Val v)
+ { (*self)(x, y, z) = v; return *self; }
+#endif
Val at(coord x, coord y, coord z)
{ return (*self)(x, y, z); }
T& set(coord x, coord y, coord z, Val v)
Index: tools/swilena/meta/swilena_describe.i
--- tools/swilena/meta/swilena_describe.i Sun, 21 Sep 2003 20:25:01 +0200 burrus_n (oln/s/38_swilena_de 1.2 640)
+++ tools/swilena/meta/swilena_describe.i Sat, 27 Sep 2003 18:32:13 +0200 burrus_n (oln/s/38_swilena_de 1.3 640)
@@ -14,10 +14,10 @@
}
#if defined(SWIGPYTHON)
- const char *__str__() {
+ std::string __str__() {
std::ostringstream os;
os << (*self);
- return os.str().c_str();
+ return os.str();
}
#endif
@@ -41,10 +41,10 @@
}
#if defined(SWIGPYTHON)
- const char *__str__() {
+ std::string __str__() {
std::ostringstream os;
os << (*self);
- return os.str().c_str();
+ return os.str();
}
#endif
2
1
Index: tools/swilena/ChangeLog
from Nicolas Burrus <burrus_n(a)lrde.epita.fr>
* meta/swilena_ntg.i: Define typemaps for python.
* meta/swilena_image.i: Don't define set, at and ref methods
taking point2d for python and ruby.
* python/tests/simple1.py: Adjust consequently.
* ruby/tests/simple1.rb: Likewise.
* doc/examples/python/simple.py: Likewise.
* doc/examples/ruby/simple.rb: Likewise.
Index: tools/swilena/meta/swilena_ntg.i
--- tools/swilena/meta/swilena_ntg.i Sat, 27 Sep 2003 19:02:23 +0200 burrus_n (oln/s/33_swilena_nt 1.4 640)
+++ tools/swilena/meta/swilena_ntg.i Sun, 28 Sep 2003 22:01:27 +0200 burrus_n (oln/s/33_swilena_nt 1.5 640)
@@ -237,3 +237,15 @@
%template(cplx_polar) ntg::cplx< ntg::polar, ntg_float >;
#define ntg_cplx_polar ntg::cplx< ntg::polar, ntg_float >
+
+#if defined(SWIGPYTHON)
+%typemap(in) ntg_uint {
+ $1 = ntg::int_u<32, ntg::strict>(PyLong_AsLong($input));
+}
+%typemap(in) ntg_sint {
+ $1 = ntg::int_s<32, ntg::strict>(PyLong_AsLong($input));
+}
+%typemap(in) ntg_bin {
+ $1 = ntg::bin(PyInt_AsLong($input));
+}
+#endif
Index: tools/swilena/meta/swilena_image.i
--- tools/swilena/meta/swilena_image.i Sat, 27 Sep 2003 18:32:13 +0200 burrus_n (oln/s/36_swilena_im 1.5 640)
+++ tools/swilena/meta/swilena_image.i Sun, 28 Sep 2003 22:01:27 +0200 burrus_n (oln/s/36_swilena_im 1.6 640)
@@ -4,7 +4,6 @@
| oln::image structures |
`----------------------*/
-
%define image_methods(T, Val, Dim)
// default constructor
@@ -24,18 +23,18 @@
bool hold(const point ## Dim ## d&) const;
%extend {
+#if defined(SWIGPYTHON) || defined(SWIGRUBY)
+ Val __getitem__(const point ## Dim ## d& p)
+ { return (*self)[p]; }
+ T& __setitem__(const point ## Dim ## d& p, Val v)
+ { (*self)[p] = v; return *self; }
+#else
Val at(const point ## Dim ## d& p)
{ return (*self)[p]; }
T& set(const point ## Dim ## d& p, Val v)
{ (*self)[p] = v; return *self; }
Val& ref(const point ## Dim ## d& p)
{ return (*self)[p]; }
-
-#if defined(SWIGPYTHON) || defined(SWIGRUBY)
- Val __getitem__(const point ## Dim ## d& p)
- { return (*self)[p]; }
- T& __setitem__(const point ## Dim ## d& p, Val v)
- { (*self)[p] = v; return *self; }
#endif
}
@@ -51,10 +50,11 @@
{ return (*self)(x); }
T __setitem__(coord x, Val v)
{ (*self)(x) = v; return *self; }
-#endif
+#else
Val at(coord x) { return (*self)(x); }
T& set(coord x, Val v) { (*self)(x) = v; return *self; }
Val& ref(coord x) { return (*self)(x); }
+#endif
}
#elif Dim == 2
@@ -67,13 +67,14 @@
{ return (*self)(x, y); }
T __setitem__(coord x, coord y, Val v)
{ (*self)(x, y) = v; return *self; }
-#endif
+#else
Val at(coord x, coord y)
{ return (*self)(x, y); }
T& set(coord x, coord y, Val v)
{ (*self)(x, y) = v; return *self; }
Val& ref(coord x, coord y)
{ return (*self)(x, y); }
+#endif
}
#elif Dim == 3
@@ -86,13 +87,14 @@
{ return (*self)(x, y, z); }
T __setitem__(coord x, coord y, coord z, Val v)
{ (*self)(x, y, z) = v; return *self; }
-#endif
+#else
Val at(coord x, coord y, coord z)
{ return (*self)(x, y, z); }
T& set(coord x, coord y, coord z, Val v)
{ (*self)(x, y, z) = v; return *self; }
Val& ref(coord x, coord y, coord z)
{ return (*self)(x, y, z); }
+#endif
}
#endif
Index: tools/swilena/python/tests/simple1.py
--- tools/swilena/python/tests/simple1.py Sat, 27 Sep 2003 19:02:23 +0200 burrus_n (oln/v/16_simple1.py 1.2 700)
+++ tools/swilena/python/tests/simple1.py Sun, 28 Sep 2003 22:01:27 +0200 burrus_n (oln/v/16_simple1.py 1.3 700)
@@ -12,7 +12,7 @@
# FIXME: uncomment when ready
#assert(lena.has_impl())
-lena.set(5, 5, uint(51))
+lena.set(5, 5, 51)
lena.ref(6, 6).value(42)
assert(lena.at(5, 5).value() == 51)
Index: tools/swilena/ruby/tests/simple1.rb
--- tools/swilena/ruby/tests/simple1.rb Sat, 27 Sep 2003 19:02:23 +0200 burrus_n (oln/v/19_simple1.rb 1.2 700)
+++ tools/swilena/ruby/tests/simple1.rb Sun, 28 Sep 2003 22:01:27 +0200 burrus_n (oln/v/19_simple1.rb 1.3 700)
@@ -16,8 +16,8 @@
# FIXME: uncomment when ready
#exit 1 unless lena.has_impl()
-lena.set(5, 5, Uint.new(51))
-lena.ref(6, 6).value(42)
+lena[5, 5] = Uint.new(51)
+lena[6, 6] = Uint.new(42)
-exit 1 unless lena.at(5, 5).value() == 51
-exit 1 unless lena.at(6, 6).value() == 42
+exit 1 unless lena[5, 5].value() == 51
+exit 1 unless lena[6, 6].value() == 42
Index: tools/swilena/doc/examples/ruby/simple.rb
--- tools/swilena/doc/examples/ruby/simple.rb Sat, 27 Sep 2003 19:02:23 +0200 burrus_n (oln/v/22_simple.rb 1.2 600)
+++ tools/swilena/doc/examples/ruby/simple.rb Sun, 28 Sep 2003 22:01:27 +0200 burrus_n (oln/v/22_simple.rb 1.3 600)
@@ -19,7 +19,7 @@
for i in 0..5 do
for j in 0..5 do
- ima.set(i, j, Uint.new(i + j))
+ ima[i, j] = Uint.new(i + j)
end
end
Index: tools/swilena/doc/examples/python/simple.py
--- tools/swilena/doc/examples/python/simple.py Sat, 27 Sep 2003 19:02:23 +0200 burrus_n (oln/v/23_simple.py 1.2 600)
+++ tools/swilena/doc/examples/python/simple.py Sun, 28 Sep 2003 22:01:27 +0200 burrus_n (oln/v/23_simple.py 1.3 600)
@@ -13,7 +13,7 @@
ima = image2d_uint(5,5)
print ima.at(5,5).value()
-ima.set(2,2,uint(2))
+ima.set(2, 2, 2)
print ima
p = ima.ref(1,1)
1
0
Désolé pour le patch un peu gros :(
1)
Ce patch résulte de plusieurs observations :
- Il n'est pas possible d'instantier les algos pour toutes combinaisons
type d'image / type de données disponibles dans olena dans un temps
acceptable.
- Quand on utilise swilena, on est typiquement en phase de prototypage
et/ou test, et on a pas envie de se prendre la tête avec le nombre
d'octets du type de donnée de manière très précise. On est en
python, on aime avoir de la souplesse et de la simplicité.
- Il est très difficile de retranscrire le comportement fortement typé
des types c++, par exemple l'addition de 2 int_u8 donne un int_u9,
etc. Sans ca, ca devient lourd à utiliser.
Du coup je n'ai gardé que qq types représentatifs : int_u32 (uint),
int_s32 (sint) et float_d (float).
2)
La deuxième chose (qui aurait mérité un autre checkin, re-désolé),
c'est l'instantiation des algos, qui a besoin d'une granularité plus
fine. En effet, la plupart des algos ne fonctionne que pour certains
types (image2d uniquement, que des types entiers, etc.). En attendant
de les corriger, generate_morpho_instantiation.py permet de tuner les
instantiations plus finement et simplement que des macros swig.
Index: tools/swilena/ChangeLog
from Nicolas Burrus <burrus_n(a)lrde.epita.fr>
* generate_morpho_instantiations.py: New file.
* meta/swilena_morpho.i: Cleanup. Remove make_xxx macros, since
instantiations are now performed by generate_morpho_instantiation.py.
* meta/swilena_structelt.i: Add common window and neighborhood
creation functions.
* meta/swilena_ntg_int_u.i, meta/swilena_ntg_int_s.i,
meta/swilena_ntg_cplx.i: Merge into...
* meta/swilena_ntg.i: ... this file. Declare only usual types.
* meta/Makefile.am: Adjust consequently.
* expand.sh: Generate uint, sint and float images only. Call
generate_morpho_instantiations.py. Adjust.
* python/tests/simple1.py: Adjust consequently.
* ruby/tests/simple1.rb: Likewise.
* doc/examples/python/simple.py: Likewise.
* doc/examples/ruby/simple.rb: Likewise.
+2003-09-27 Nicolas Burrus <burrus_n(a)lrde.epita.fr>
+
* meta/swilena_image.i: Add operator[] for python and ruby.
* meta/swilena_describe.i: Fix __str__ return type.
Index: tools/swilena/expand.sh
--- tools/swilena/expand.sh Mon, 22 Sep 2003 00:41:25 +0200 burrus_n (oln/s/25_expand.sh 1.9 750)
+++ tools/swilena/expand.sh Sat, 27 Sep 2003 19:02:23 +0200 burrus_n (oln/s/25_expand.sh 1.10 750)
@@ -9,14 +9,15 @@
mkdir -p "$SWILENA/python"
mkdir -p "$SWILENA/ruby"
-MODULES="$MODULES ntg ntg_cplx ntg_int_u ntg_int_s"
+MODULES="$MODULES ntg morpho"
for dim in 1 2 3; do
## {1d,2d,3d} families
for mod in point structelt w_win imagesize image; do
cat >"$SWILENA/src/swilena_$mod${dim}d.i" <<EOF
-%include swilena_$mod.i
+// Warning: this file was generated by expand.sh
%module swilena_$mod${dim}d
+%include swilena_$mod.i
decl_$mod($dim)
EOF
MODULES="$MODULES ${mod}${dim}d"
@@ -30,20 +31,20 @@
## Image instances
cat >>"$SWILENA/src/swilena_image${dim}d.i" <<EOF
%import swilena_ntg.i
-%import swilena_ntg_int_u.i
-%import swilena_ntg_int_s.i
EOF
- for t in bin \
- int_u8 int_u16 int_u32 \
- int_s8 int_s16 int_s32 \
- int_u8s int_u16s int_u32s \
- int_s8s int_s16s int_s32s \
- float_s float_d # rgb_8 rgb_16 rgb_32
- do
- short=`echo $t | sed -e 's,int_,,g;s,_,,g'`
- echo "make_image(image${dim}d_$short, $dim, ntg_$t)" >> "$SWILENA/src/swilena_image${dim}d.i"
- done
-done
+ # int_u8 int_u16 int_s8 int_s16 int_s8s int_s16s int_s32s
+ # int_u8s int_u16s int_u32s
+ # float_s rgb_8 rgb_16 rgb_32
+ cat >> "$SWILENA/src/swilena_image${dim}d.i" <<EOF
+make_image(image${dim}d_bin, $dim, ntg_bin)
+make_image(image${dim}d_uint, $dim, ntg_uint)
+make_image(image${dim}d_sint, $dim, ntg_sint)
+make_image(image${dim}d_float, $dim, ntg_float)
+EOF
+ ## Morpho algorithms
+ MODULES="$MODULES morpho${dim}d"
+ cd "$SWILENA/src" && ../generate_morpho_instantiations.py && cd ..
+done # for dim ...
#################### Python stuff #######################
@@ -53,9 +54,9 @@
header_python()
{
cat <<EOF
-## Process this file through Automake to produce Makefile.in -*- Makefile -*-
+## Include this file into your Makefile.am -*- Makefile -*-
##
-## Makefile.am for swilena/python
+## makefile.swig for swilena/python
## NOTE: this file was generated automatically by expand.sh
##
@@ -111,9 +112,9 @@
header_ruby()
{
cat <<EOF
-## Process this file through Automake to produce Makefile.in -*- Makefile -*-
+## Include this file in your Makefile.am -*- Makefile -*-
##
-## Makefile.am for swilena/ruby
+## makefile.swig for swilena/ruby
## NOTE: this file was generated automatically by expand.sh
##
@@ -158,9 +159,9 @@
header_src() {
cat <<EOF
-## Process this file through Automake to produce Makefile.in -*- Makefile -*-
+## Include this file in your Makefile.am
##
-## Makefile.am for swilena/src
+## makefile.swig for swilena/src
## NOTE: this file was generated automatically by expand.sh
##
EOF
@@ -184,7 +185,6 @@
############ Output ###############
-
header_src >"$SWILENA/src/makefile.swig"
dump_src >>"$SWILENA/src/makefile.swig"
header_python >"$SWILENA/python/makefile.swig"
Index: tools/swilena/meta/Makefile.am
--- tools/swilena/meta/Makefile.am Tue, 06 May 2003 06:56:14 +0200 raph (oln/s/26_Makefile.a 1.1 640)
+++ tools/swilena/meta/Makefile.am Sat, 27 Sep 2003 19:02:23 +0200 burrus_n (oln/s/26_Makefile.a 1.2 640)
@@ -2,6 +2,6 @@
EXTRA_DIST = swilena_core.i swilena_decl.i swilena_describe.i \
swilena_exception.i swilena_image.i swilena_imagesize.i \
- swilena_morpho.i swilena_ntg.i swilena_ntg_cplx.i swilena_ntg_int_s.i \
- swilena_ntg_int_u.i swilena_point.i swilena_structelt.i \
+ swilena_morpho.i swilena_ntg.i swilena_point.i \
+ swilena_structelt.i \
swilena_w_win.i
Index: tools/swilena/meta/swilena_structelt.i
--- tools/swilena/meta/swilena_structelt.i Tue, 29 Jul 2003 18:21:22 +0200 david (oln/s/28_swilena_st 1.2 640)
+++ tools/swilena/meta/swilena_structelt.i Sat, 27 Sep 2003 19:02:23 +0200 burrus_n (oln/s/28_swilena_st 1.3 640)
@@ -109,11 +109,55 @@
structelt_methods_now(window ## Dim ## d, Dim)
};
+#if Dim == 1
+ const window1d& win_c2_only();
+ const window1d& win_c2p();
+ window1d mk_win_segment(unsigned);
+#elif Dim == 2
+ const window2d& win_c4_only();
+ const window2d& win_c4p();
+ const window2d& win_c8_only();
+ const window2d& win_c8p();
+ window2d mk_win_rectangle(unsigned, unsigned);
+ window2d mk_win_ellipse(float, float);
+ window2d mk_win_square(unsigned);
+ window2d mk_win_disc(float);
+#elif Dim == 3
+ const window3d& win_c6_only();
+ const window3d& win_c6p();
+ const window3d& win_c18_only();
+ const window3d& win_c18p();
+ const window3d& win_c26_only();
+ const window3d& win_c26p();
+ window3d mk_win_block(unsigned, unsigned, unsigned);
+ window3d mk_win_ellipsoid(float, float, float);
+ window3d mk_win_cube(unsigned);
+ window3d mk_win_ball(float);
+#endif
+
struct neighborhood ## Dim ## d
{
structelt_methods_now(neighborhood ## Dim ## d, Dim)
};
+#if Dim == 1
+ const neighborhood1d& neighb_c2();
+ neighborhood1d mk_neighb_segment(unsigned);
+ window1d mk_win_from_neighb(const neighborhood1d&);
+#elif Dim == 2
+ const neighborhood2d& neighb_c4();
+ const neighborhood2d& neighb_c8();
+ neighborhood2d mk_neighb_square(unsigned);
+ neighborhood2d mk_neighb_rectangle(unsigned, unsigned);
+ window2d mk_win_from_neighb(const neighborhood2d&);
+#elif Dim == 3
+ const neighborhood3d& neighb_c6();
+ const neighborhood3d& neighb_c18();
+ const neighborhood3d& neighb_c26();
+ neighborhood3d mk_neighb_block(unsigned, unsigned, unsigned);
+ neighborhood3d mk_neighb_cube(unsigned);
+ window3d mk_win_from_neighb(const neighborhood3d&);
+#endif
}
%enddef
Index: tools/swilena/meta/swilena_ntg.i
--- tools/swilena/meta/swilena_ntg.i Sun, 21 Sep 2003 21:59:21 +0200 burrus_n (oln/s/33_swilena_nt 1.3 640)
+++ tools/swilena/meta/swilena_ntg.i Sat, 27 Sep 2003 19:02:23 +0200 burrus_n (oln/s/33_swilena_nt 1.4 640)
@@ -4,7 +4,7 @@
/***** Generic class declaration for scalars ******/
%define decl_scalar_class(Ns, Name, ValueType)
-template<unsigned nbits, typename behaviour>
+template<unsigned nbits, typename behavior>
class Name
{
public:
@@ -15,65 +15,65 @@
ValueType value() const
{ return (*self); }
void value(ValueType x)
- { *self = Ns::Name<nbits, behaviour>(x); }
+ { *self = Ns::Name<nbits, behavior>(x); }
#if defined(SWIGPYTHON) || defined(SWIGRUBY)
- Ns::Name<nbits, behaviour> operator+ (const Ns::Name<nbits, behaviour>& other) const { return (*self) + other; }
- Ns::Name<nbits, behaviour> operator- (const Ns::Name<nbits, behaviour>& other) const { return (*self) - other; }
- Ns::Name<nbits, behaviour> operator* (const Ns::Name<nbits, behaviour>& other) const { return (*self) * other; }
- Ns::Name<nbits, behaviour> operator/ (const Ns::Name<nbits, behaviour>& other) const { return (*self) / other; }
- Ns::Name<nbits, behaviour> operator+ (ValueType other) const { return (*self) + other; }
- Ns::Name<nbits, behaviour> operator- (ValueType other) const { return (*self) - other; }
- Ns::Name<nbits, behaviour> operator* (ValueType other) const { return (*self) * other; }
- Ns::Name<nbits, behaviour> operator/ (ValueType other) const { return (*self) / other; }
+ Ns::Name<nbits, behavior> operator+ (const Ns::Name<nbits, behavior>& other) const { return (*self) + other; }
+ Ns::Name<nbits, behavior> operator- (const Ns::Name<nbits, behavior>& other) const { return (*self) - other; }
+ Ns::Name<nbits, behavior> operator* (const Ns::Name<nbits, behavior>& other) const { return (*self) * other; }
+ Ns::Name<nbits, behavior> operator/ (const Ns::Name<nbits, behavior>& other) const { return (*self) / other; }
+ Ns::Name<nbits, behavior> operator+ (ValueType other) const { return (*self) + other; }
+ Ns::Name<nbits, behavior> operator- (ValueType other) const { return (*self) - other; }
+ Ns::Name<nbits, behavior> operator* (ValueType other) const { return (*self) * other; }
+ Ns::Name<nbits, behavior> operator/ (ValueType other) const { return (*self) / other; }
#else
- Ns::Name<nbits, behaviour> add (const Ns::Name<nbits, behaviour>& other) const { return (*self) + other; }
- Ns::Name<nbits, behaviour> sub (const Ns::Name<nbits, behaviour>& other) const { return (*self) - other; }
- Ns::Name<nbits, behaviour> mul (const Ns::Name<nbits, behaviour>& other) const { return (*self) * other; }
- Ns::Name<nbits, behaviour> div (const Ns::Name<nbits, behaviour>& other) const { return (*self) / other; }
- Ns::Name<nbits, behaviour> add (ValueType other) const { return (*self) + other; }
- Ns::Name<nbits, behaviour> sub (ValueType other) const { return (*self) - other; }
- Ns::Name<nbits, behaviour> mul (ValueType other) const { return (*self) * other; }
- Ns::Name<nbits, behaviour> div (ValueType other) const { return (*self) / other; }
+ Ns::Name<nbits, behavior> add (const Ns::Name<nbits, behavior>& other) const { return (*self) + other; }
+ Ns::Name<nbits, behavior> sub (const Ns::Name<nbits, behavior>& other) const { return (*self) - other; }
+ Ns::Name<nbits, behavior> mul (const Ns::Name<nbits, behavior>& other) const { return (*self) * other; }
+ Ns::Name<nbits, behavior> div (const Ns::Name<nbits, behavior>& other) const { return (*self) / other; }
+ Ns::Name<nbits, behavior> add (ValueType other) const { return (*self) + other; }
+ Ns::Name<nbits, behavior> sub (ValueType other) const { return (*self) - other; }
+ Ns::Name<nbits, behavior> mul (ValueType other) const { return (*self) * other; }
+ Ns::Name<nbits, behavior> div (ValueType other) const { return (*self) / other; }
#endif
#if defined(SWIGPYTHON)
- Ns::Name<nbits, behaviour>& operator+= (const Ns::Name<nbits, behaviour>& other) { return (*self) += other; }
- Ns::Name<nbits, behaviour>& operator-= (const Ns::Name<nbits, behaviour>& other) { return (*self) -= other; }
- Ns::Name<nbits, behaviour>& operator*= (const Ns::Name<nbits, behaviour>& other) { return (*self) *= other; }
- Ns::Name<nbits, behaviour>& operator/= (const Ns::Name<nbits, behaviour>& other) { return (*self) /= other; }
- Ns::Name<nbits, behaviour>& operator+= (ValueType other) { return (*self) += other; }
- Ns::Name<nbits, behaviour>& operator-= (ValueType other) { return (*self) -= other; }
- Ns::Name<nbits, behaviour>& operator*= (ValueType other) { return (*self) *= other; }
- Ns::Name<nbits, behaviour>& operator/= (ValueType other) { return (*self) /= other; }
+ Ns::Name<nbits, behavior>& operator+= (const Ns::Name<nbits, behavior>& other) { return (*self) += other; }
+ Ns::Name<nbits, behavior>& operator-= (const Ns::Name<nbits, behavior>& other) { return (*self) -= other; }
+ Ns::Name<nbits, behavior>& operator*= (const Ns::Name<nbits, behavior>& other) { return (*self) *= other; }
+ Ns::Name<nbits, behavior>& operator/= (const Ns::Name<nbits, behavior>& other) { return (*self) /= other; }
+ Ns::Name<nbits, behavior>& operator+= (ValueType other) { return (*self) += other; }
+ Ns::Name<nbits, behavior>& operator-= (ValueType other) { return (*self) -= other; }
+ Ns::Name<nbits, behavior>& operator*= (ValueType other) { return (*self) *= other; }
+ Ns::Name<nbits, behavior>& operator/= (ValueType other) { return (*self) /= other; }
#elseif !defined(SWIGRUBY) // These operators are generated by default in Ruby
- Ns::Name<nbits, behaviour>& iadd (const Ns::Name<nbits, behaviour>& other) { return (*self) += other; }
- Ns::Name<nbits, behaviour>& isub (const Ns::Name<nbits, behaviour>& other) { return (*self) -= other; }
- Ns::Name<nbits, behaviour>& imul (const Ns::Name<nbits, behaviour>& other) { return (*self) *= other; }
- Ns::Name<nbits, behaviour>& idiv (const Ns::Name<nbits, behaviour>& other) { return (*self) /= other; }
- Ns::Name<nbits, behaviour>& iadd (ValueType other) { return (*self) += other; }
- Ns::Name<nbits, behaviour>& isub (ValueType other) { return (*self) -= other; }
- Ns::Name<nbits, behaviour>& imul (ValueType other) { return (*self) *= other; }
- Ns::Name<nbits, behaviour>& idiv (ValueType other) { return (*self) /= other; }
+ Ns::Name<nbits, behavior>& iadd (const Ns::Name<nbits, behavior>& other) { return (*self) += other; }
+ Ns::Name<nbits, behavior>& isub (const Ns::Name<nbits, behavior>& other) { return (*self) -= other; }
+ Ns::Name<nbits, behavior>& imul (const Ns::Name<nbits, behavior>& other) { return (*self) *= other; }
+ Ns::Name<nbits, behavior>& idiv (const Ns::Name<nbits, behavior>& other) { return (*self) /= other; }
+ Ns::Name<nbits, behavior>& iadd (ValueType other) { return (*self) += other; }
+ Ns::Name<nbits, behavior>& isub (ValueType other) { return (*self) -= other; }
+ Ns::Name<nbits, behavior>& imul (ValueType other) { return (*self) *= other; }
+ Ns::Name<nbits, behavior>& idiv (ValueType other) { return (*self) /= other; }
#endif
#if defined(SWIGPYTHON) || defined(SWIGRUBY)
- bool operator< (const Ns::Name<nbits, behaviour>& other) const { return (*self) < other; }
- bool operator> (const Ns::Name<nbits, behaviour>& other) const { return (*self) > other; }
- bool operator<= (const Ns::Name<nbits, behaviour>& other) const { return (*self) <= other; }
- bool operator>= (const Ns::Name<nbits, behaviour>& other) const { return (*self) >= other; }
- bool operator== (const Ns::Name<nbits, behaviour>& other) const { return (*self) == other; }
+ bool operator< (const Ns::Name<nbits, behavior>& other) const { return (*self) < other; }
+ bool operator> (const Ns::Name<nbits, behavior>& other) const { return (*self) > other; }
+ bool operator<= (const Ns::Name<nbits, behavior>& other) const { return (*self) <= other; }
+ bool operator>= (const Ns::Name<nbits, behavior>& other) const { return (*self) >= other; }
+ bool operator== (const Ns::Name<nbits, behavior>& other) const { return (*self) == other; }
bool operator< (ValueType other) const { return (*self) < other; }
bool operator> (ValueType other) const { return (*self) > other; }
bool operator<= (ValueType other) const { return (*self) <= other; }
bool operator>= (ValueType other) const { return (*self) >= other; }
bool operator== (ValueType other) const { return (*self) == other; }
#else
- bool lt (const Ns::Name<nbits, behaviour>& other) const { return (*self) < other; }
- bool gt (const Ns::Name<nbits, behaviour>& other) const { return (*self) > other; }
- bool le (const Ns::Name<nbits, behaviour>& other) const { return (*self) <= other; }
- bool ge (const Ns::Name<nbits, behaviour>& other) const { return (*self) >= other; }
- bool eq (const Ns::Name<nbits, behaviour>& other) const { return (*self) == other; }
+ bool lt (const Ns::Name<nbits, behavior>& other) const { return (*self) < other; }
+ bool gt (const Ns::Name<nbits, behavior>& other) const { return (*self) > other; }
+ bool le (const Ns::Name<nbits, behavior>& other) const { return (*self) <= other; }
+ bool ge (const Ns::Name<nbits, behavior>& other) const { return (*self) >= other; }
+ bool eq (const Ns::Name<nbits, behavior>& other) const { return (*self) == other; }
bool lt (ValueType other) const { return (*self) < other; }
bool gt (ValueType other) const { return (*self) > other; }
bool le (ValueType other) const { return (*self) <= other; }
@@ -82,16 +82,16 @@
#endif
#if defined(SWIGPYTHON)
- bool operator!= (const Ns::Name<nbits, behaviour>& other) const { return (*self) != other; }
+ bool operator!= (const Ns::Name<nbits, behavior>& other) const { return (*self) != other; }
bool operator!= (ValueType other) const { return (*self) != other; }
#elseif !defined(SWIGRUBY)
- bool ne (const Ns::Name<nbits, behaviour>& other) const { return (*self) != other; }
+ bool ne (const Ns::Name<nbits, behavior>& other) const { return (*self) != other; }
bool ne (ValueType other) const { return (*self) != other; }
#endif
}
- EXTEND_DESCRIBE2(Ns::Name<nbits, behaviour>);
+ EXTEND_DESCRIBE2(Ns::Name<nbits, behavior>);
};
%enddef
@@ -206,7 +206,34 @@
decl_ntg()
-// Compatibility macro, see swilena_ntg_int_u.i
+/*
+ Macro are defined for every type and should be used in all modules
+ Using ntg::int_u32 (the typedef in predecls.hh) directly leads to
+ type matching problems:
+
+ - it is a typedef never used in module swilena_ntg
+ => no type correspondence is created between ntg::int_u32
+ and ntg::int_u<32, ntg::strict>.
+
+ - if another module use ntg::int_u32, operations on it won't be
+ possible since this module won't recognize the type ntg::int_u32.
+
+ - ntg::int_u<32, ntg::strict> or ntg_uint should be used
+ everywhere. ntg_uint is just a convenient macro.
+*/
+
#define ntg_bin ntg::bin
-#define ntg_float_s ntg::float_s
-#define ntg_float_d ntg::float_d
+
+%template(uint) ntg::int_u< 32, ntg::strict >;
+#define ntg_uint ntg::int_u< 32, ntg::strict >
+
+%template(sint) ntg::int_s< 32, ntg::strict >;
+#define ntg_sint ntg::int_s< 32, ntg::strict >
+
+#define ntg_float ntg::float_d
+
+%template(cplx_rect) ntg::cplx< ntg::rect, ntg_float >;
+#define ntg_cplx_rect ntg::cplx< ntg::rect, ntg_float >
+
+%template(cplx_polar) ntg::cplx< ntg::polar, ntg_float >;
+#define ntg_cplx_polar ntg::cplx< ntg::polar, ntg_float >
Index: tools/swilena/meta/swilena_morpho.i
--- tools/swilena/meta/swilena_morpho.i Tue, 06 May 2003 06:56:14 +0200 raph (oln/s/34_swilena_mo 1.1 640)
+++ tools/swilena/meta/swilena_morpho.i Sat, 27 Sep 2003 19:02:23 +0200 burrus_n (oln/s/34_swilena_mo 1.2 640)
@@ -1,34 +1,48 @@
// -*- C++ -*-
+%module swilena_morpho
+
+/*
+ Algorithms are supported by a simple two-level mechanism:
+
+ - Declare a my_algorithm template function accepting all type of
+ parameters. This is the goal of the decl_morpho_xxx macros.
+ ex:
+ template <class Ret, class A1, A2>
+ Ret my_algorithm(A1& a1, A2& a2);
+
+ - Instantiate it for every possible type. This is the goal of the
+ generate_morpho_instantiations.py script.
+*/
+
/********** Morpho algorithms taking two arguments ***********/
%define decl_morpho_2(Incl, Func, HAS_FAST)
+
%{
#include Incl
%}
%inline %{
-template<typename R, typename A1, typename A2 >
-static R my_ ## Func( A1& a1, A2& a2)
+template<typename Ret, typename A1, typename A2>
+static Ret my_ ## Func(A1& a1, A2& a2)
{ return oln::morpho::Func(a1, a2); }
%}
+
#if HAS_FAST
%inline %{
-template<typename R, typename A1, typename A2 >
-static R my_fast_ ## Func( A1& a1, A2& a2)
-{ return oln::morpho::fast::Func(a1, a2); }
-%}
-#endif
-%enddef
-%define make_morpho_2(Func, R, A1, A2, HAS_FAST)
-%template(Func) my_ ## Func<R, A1, A2 >;
-#if HAS_FAST
-%template(fast_ ## Func) my_fast_ ## Func<R, A1, A2 >;
+template<typename Ret, typename A1, typename A2 >
+static Ret my_fast_ ## Func(A1& a1, A2& a2)
+{
+ return oln::morpho::fast::Func(a1, a2);
+}
+
+%}
#endif
%enddef
-/************ Morpho algorithms taking three arguments *******************/
+/************ Morpho algorithms taking three arguments ************/
%define decl_morpho_3(Incl, Func, HAS_FAST)
%{
@@ -36,27 +50,21 @@
%}
%inline %{
-template<typename R, typename A1, typename A2, typename A3>
-static R my_ ## Func( A1& a1, A2& a2, A3& a3)
+template<typename Ret, typename A1, typename A2, typename A3>
+static Ret my_ ## Func(A1& a1, A2& a2, A3& a3)
{ return oln::morpho::Func(a1, a2, a3); }
%}
#if HAS_FAST
%inline %{
-template<typename R, typename A1, typename A2, typename A3>
-static R my_fast_ ## Func( A1& a1, A2& a2, A3& a3)
+template<typename Ret, typename A1, typename A2, typename A3>
+static Ret my_fast_ ## Func(A1& a1, A2& a2, A3& a3)
{ return oln::morpho::fast::Func(a1, a2, a3); }
%}
#endif
%enddef
-%define make_morpho_3(Func, R, A1, A2, A3, HAS_FAST)
-%template(Func) my_ ## Func<R, A1, A2, A3 >;
-#if HAS_FAST
-%template(fast_ ## Func) my_fast_ ## Func<R, A1, A2, A3 >;
-#endif
-%enddef
-/************ Morpho algorithms taking four arguments *******************/
+/************ Morpho algorithms taking four arguments ************/
%define decl_morpho_4(Incl, Func, HAS_FAST)
%{
@@ -64,27 +72,22 @@
%}
%inline %{
-template<typename R, typename A1, typename A2, typename A3, typename A4>
-static R my_ ## Func( A1& a1, A2& a2, A3& a3, A4& a4)
+template<typename Ret, typename A1, typename A2, typename A3, typename A4>
+static Ret my_ ## Func( A1& a1, A2& a2, A3& a3, A4& a4)
{ return oln::morpho::Func(a1, a2, a3, a4); }
%}
#if HAS_FAST
%inline %{
-template<typename R, typename A1, typename A2, typename A3, typename A4>
-static R my_fast_ ## Func( A1& a1, A2& a2, A3& a3, A4& a4)
+template<typename Ret, typename A1, typename A2, typename A3, typename A4>
+static Ret my_fast_ ## Func( A1& a1, A2& a2, A3& a3, A4& a4)
{ return oln::morpho::fast::Func(a1, a2, a3, a4); }
%}
#endif
%enddef
-%define make_morpho_4(Func, R, A1, A2, A3, A4, HAS_FAST)
-%template(Func) my_ ## Func<R, A1, A2, A3, A4 >;
-#if HAS_FAST
-%template(fast_ ## Func) my_fast_ ## Func<R, A1, A2, A3, A4 >;
-#endif
-%enddef
-/************ Morpho algorithms taking three arguments and located in three namespaces ****************/
+/************ Morpho algorithms taking three arguments **************/
+/************ and located in sure, sequential and hybrid ************/
%define decl_morpho_3ssh(Incl, Func)
%{
@@ -92,24 +95,20 @@
%}
%inline %{
-template<typename R, typename A1, typename A2, typename A3>
-static R my_sure_ ## Func( A1& a1, A2& a2, A3& a3)
+template<typename Ret, typename A1, typename A2, typename A3>
+static Ret my_sure_ ## Func( A1& a1, A2& a2, A3& a3)
{ return oln::morpho::sure::Func(a1, a2, a3); }
-template<typename R, typename A1, typename A2, typename A3>
-static R my_sequential_ ## Func( A1& a1, A2& a2, A3& a3)
+template<typename Ret, typename A1, typename A2, typename A3>
+static Ret my_sequential_ ## Func( A1& a1, A2& a2, A3& a3)
{ return oln::morpho::sequential::Func(a1, a2, a3); }
-template<typename R, typename A1, typename A2, typename A3>
-static R my_hybrid_ ## Func( A1& a1, A2& a2, A3& a3)
+template<typename Ret, typename A1, typename A2, typename A3>
+static Ret my_hybrid_ ## Func( A1& a1, A2& a2, A3& a3)
{ return oln::morpho::hybrid::Func(a1, a2, a3); }
%}
%enddef
-%define make_morpho_3ssh(Func, R, A1, A2, A3)
-%template(sure_ ## Func) my_sure_ ## Func<R, A1, A2, A3 >;
-%template(sequential_ ## Func) my_sequential_ ## Func<R, A1, A2, A3 >;
-%template(hybrid_ ## Func) my_hybrid_ ## Func<R, A1, A2, A3 >;
-%enddef
-/************ Morpho algorithms taking two arguments and located in three namespaces ****************/
+/************ Morpho algorithms taking two arguments **************/
+/************ and located in sure, sequential and hybrid **********/
%define decl_morpho_2ssh(Incl, Func)
%{
@@ -117,42 +116,34 @@
%}
%inline %{
-template<typename R, typename A1, typename A2>
-static R my_sure_ ## Func( A1& a1, A2& a2)
+template<typename Ret, typename A1, typename A2>
+static Ret my_sure_ ## Func( A1& a1, A2& a2)
{ return oln::morpho::sure::Func(a1, a2); }
-template<typename R, typename A1, typename A2>
-static R my_sequential_ ## Func( A1& a1, A2& a2)
+template<typename Ret, typename A1, typename A2>
+static Ret my_sequential_ ## Func( A1& a1, A2& a2)
{ return oln::morpho::sequential::Func(a1, a2); }
-template<typename R, typename A1, typename A2>
-static R my_hybrid_ ## Func( A1& a1, A2& a2)
+template<typename Ret, typename A1, typename A2>
+static Ret my_hybrid_ ## Func( A1& a1, A2& a2)
{ return oln::morpho::hybrid::Func(a1, a2); }
%}
%enddef
-%define make_morpho_2ssh(Func, R, A1, A2)
-%template(sure_ ## Func) my_sure_ ## Func<R, A1, A2>;
-%template(sequential_ ## Func) my_sequential_ ## Func<R, A1, A2>;
-%template(hybrid_ ## Func) my_hybrid_ ## Func<R, A1, A2>;
-%enddef
-/************ Morpho algorithms taking three arguments and located in two namespaces ****************/
+/************ Morpho algorithms taking three arguments ***********/
+/************ and located in morpho and morpho::sure ***********/
%define decl_morpho_3ss(Incl, Func)
%{
#include Incl
%}
%inline %{
-template<typename R, typename A1, typename A2, typename A3>
-static R my_ ## Func( A1& a1, A2& a2, A3& a3)
+template<typename Ret, typename A1, typename A2, typename A3>
+static Ret my_ ## Func( A1& a1, A2& a2, A3& a3)
{ return oln::morpho::Func(a1, a2, a3); }
-template<typename R, typename A1, typename A2, typename A3>
-static R my_sure_ ## Func( A1& a1, A2& a2, A3& a3)
+template<typename Ret, typename A1, typename A2, typename A3>
+static Ret my_sure_ ## Func( A1& a1, A2& a2, A3& a3)
{ return oln::morpho::sure::Func(a1, a2, a3); }
%}
%enddef
-%define make_morpho_3ss(Func, R, A1, A2, A3)
-%template(Func) my_ ## Func<R, A1, A2, A3 >;
-%template(sure_ ## Func) my_sure_ ## Func<R, A1, A2, A3 >;
-%enddef
/*************** Watershed *****************/
@@ -161,16 +152,36 @@
#include <oln/morpho/watershed.hh>
%}
%inline %{
-template<typename Ret, typename Dt, typename I, typename N>
+template<typename Ret, typename I, typename N>
static Ret my_ ## Func( I& img, N& neigh)
-{ return oln::morpho::Func<Dt >(img, neigh); }
+{ return oln::morpho::Func<oln_value_type(Ret)>(img, neigh); }
%}
%enddef
-%define make_morpho_watershed(Func, R, Dt, Img, Neigh)
-%template(Func ## _ ## Dt) my_ ## Func<R, Dt, Img, Neigh >;
+
+/************ Extrema killers ***********/
+
+%define decl_morpho_extrema_killer(Incl, Func)
+%{
+#include Incl
+%}
+
+%inline %{
+template<typename Img, typename Neighb>
+static Img my_ ## Func(const Img& a1, unsigned area, const Neighb& a3)
+{ return oln::morpho::Func(a1, area, a3); }
+%}
%enddef
/***************** Function families **********************/
+
+/*-----------------.
+| Classical family |
+`-----------------*/
+
+/*
+ Declare generic functions for classical algorithms
+*/
+
%define decl_classical_family()
decl_morpho_2(<oln/morpho/erosion.hh>, erosion, 1)
decl_morpho_2(<oln/morpho/dilation.hh>, dilation, 1)
@@ -222,62 +233,31 @@
decl_morpho_3(<oln/morpho/hit_or_miss.hh>, hit_or_miss_closing_bg, 1)
%enddef
-%define make_classical_family(Img, M, W, N)
- make_morpho_2(erosion, Img, Img, W, 1)
- make_morpho_2(dilation, Img, Img, W, 1)
-
- make_morpho_3(thickening, Img, Img, W, W, 1)
- make_morpho_3(thinning, Img, Img, W, W, 1)
-
- make_morpho_3ss(geodesic_erosion, Img, Img, Img, N)
- make_morpho_3ss(geodesic_dilation, Img, Img, Img, N)
- make_morpho_3ssh(geodesic_reconstruction_dilation, Img, Img, Img, N)
- make_morpho_3ssh(geodesic_reconstruction_erosion, Img, Img, Img, N)
-
- make_morpho_3ssh(minima_imposition, Img, Img, M, N)
- make_morpho_2ssh(regional_minima, M, Img, N)
-
-
- make_morpho_2(beucher_gradient, Img, Img, W, 1)
- make_morpho_2(internal_gradient, Img, Img, W, 1)
- make_morpho_2(external_gradient, Img, Img, W, 1)
-
- // FIXME: this is broken for the moment (why ?)
-/* make_morpho_2(laplacian, Img, Img, W, 1) */
-
- make_morpho_2(white_top_hat, Img, Img, W, 1)
- make_morpho_2(black_top_hat, Img, Img, W, 1)
- make_morpho_2(self_complementary_top_hat, Img, Img, W, 1)
- make_morpho_2(top_hat_contrast_op, Img, Img, W, 1)
-
- make_morpho_3(hit_or_miss, Img, Img, W, W, 1)
- make_morpho_3(hit_or_miss_opening, Img, Img, W, W, 1)
- make_morpho_3(hit_or_miss_opening_bg, Img, Img, W, W, 1)
- make_morpho_3(hit_or_miss_closing, Img, Img, W, W, 1)
- make_morpho_3(hit_or_miss_closing_bg, Img, Img, W, W, 1)
-
-%enddef
+/*----------------------.
+| Extrema killer family |
+`----------------------*/
%define decl_extrema_killer_family()
- decl_morpho_3(<oln/morpho/extrema_killer.hh>, sure_maxima_killer, 0)
- decl_morpho_3(<oln/morpho/extrema_killer.hh>, fast_maxima_killer, 0)
- decl_morpho_3(<oln/morpho/extrema_killer.hh>, sure_minima_killer, 0)
- decl_morpho_3(<oln/morpho/extrema_killer.hh>, fast_minima_killer, 0)
-%enddef
-%define make_extrema_killer_family(Img, N)
- make_morpho_3(sure_maxima_killer, Img, Img, unsigned, N, 0)
- make_morpho_3(fast_maxima_killer, Img, Img, unsigned, N, 0)
- make_morpho_3(sure_minima_killer, Img, Img, unsigned, N, 0)
- make_morpho_3(fast_minima_killer, Img, Img, unsigned, N, 0)
+ decl_morpho_extrema_killer(<oln/morpho/extrema_killer.hh>,
+ sure_maxima_killer)
+ decl_morpho_extrema_killer(<oln/morpho/extrema_killer.hh>,
+ fast_maxima_killer)
+ decl_morpho_extrema_killer(<oln/morpho/extrema_killer.hh>,
+ sure_minima_killer)
+ decl_morpho_extrema_killer(<oln/morpho/extrema_killer.hh>,
+ fast_minima_killer)
%enddef
+/*-----------------.
+| Watershed family |
+`-----------------*/
+
%define decl_watershed_family()
decl_morpho_watershed(watershed_seg)
decl_morpho_watershed(watershed_con)
decl_morpho_3(<oln/morpho/watershed.hh>, watershed_seg_or, 0)
%enddef
-%define make_watershed_family(Dt, Img1, Img2, N)
- make_morpho_watershed(watershed_seg, Img2, Dt, Img1, N)
- make_morpho_watershed(watershed_con, Img2, Dt, Img1, N)
- make_morpho_3(watershed_seg_or, Img2, Img1, Img2, N, 0)
-%enddef
+
+decl_classical_family()
+decl_watershed_family()
+decl_extrema_killer_family()
Index: tools/swilena/meta/swilena_decl.i
--- tools/swilena/meta/swilena_decl.i Tue, 06 May 2003 06:56:14 +0200 raph (oln/s/39_swilena_de 1.1 640)
+++ tools/swilena/meta/swilena_decl.i Sat, 27 Sep 2003 19:02:23 +0200 burrus_n (oln/s/39_swilena_de 1.2 640)
@@ -72,5 +72,3 @@
%define swmake5(Name, R, A1, A2, A3, A4, A5)
%template(Name) my_ ## Name<R, A1, A2, A3, A4, A5 >;
%enddef
-
-
Index: tools/swilena/python/tests/simple1.py
--- tools/swilena/python/tests/simple1.py Sun, 21 Sep 2003 23:13:48 +0200 burrus_n (oln/v/16_simple1.py 1.1 700)
+++ tools/swilena/python/tests/simple1.py Sat, 27 Sep 2003 19:02:23 +0200 burrus_n (oln/v/16_simple1.py 1.2 700)
@@ -3,16 +3,16 @@
import os
import sys
from swilena_image2d import *
-from swilena_ntg_int_u import *
+from swilena_ntg import *
imgdir = os.environ['IMGDIR']
-lena = image2d_u8()
+lena = image2d_uint()
lena.load(imgdir + "/lena.pgm")
# FIXME: uncomment when ready
#assert(lena.has_impl())
-lena.set(5, 5, int_u8(51))
+lena.set(5, 5, uint(51))
lena.ref(6, 6).value(42)
assert(lena.at(5, 5).value() == 51)
Index: tools/swilena/ruby/tests/simple1.rb
--- tools/swilena/ruby/tests/simple1.rb Sun, 21 Sep 2003 23:13:48 +0200 burrus_n (oln/v/19_simple1.rb 1.1 700)
+++ tools/swilena/ruby/tests/simple1.rb Sat, 27 Sep 2003 19:02:23 +0200 burrus_n (oln/v/19_simple1.rb 1.2 700)
@@ -4,19 +4,19 @@
$: << ENV["SWILENA_PATH"] if ENV.has_key? "SWILENA_PATH"
require "swilena_image2d"
-require "swilena_ntg_int_u"
+require "swilena_ntg"
-include Swilena_ntg_int_u
+include Swilena_ntg
include Swilena_image2d
imgdir = ENV["IMGDIR"]
-lena = Image2d_u8.new
+lena = Image2d_uint.new
lena.load(imgdir + "/lena.pgm")
# FIXME: uncomment when ready
#exit 1 unless lena.has_impl()
-lena.set(5, 5, Int_u8.new(51))
+lena.set(5, 5, Uint.new(51))
lena.ref(6, 6).value(42)
exit 1 unless lena.at(5, 5).value() == 51
Index: tools/swilena/doc/examples/ruby/simple.rb
--- tools/swilena/doc/examples/ruby/simple.rb Mon, 22 Sep 2003 00:41:25 +0200 burrus_n (oln/v/22_simple.rb 1.1 600)
+++ tools/swilena/doc/examples/ruby/simple.rb Sat, 27 Sep 2003 19:02:23 +0200 burrus_n (oln/v/22_simple.rb 1.2 600)
@@ -4,10 +4,10 @@
$: << ENV["SWILENA_PATH"] if ENV.has_key? "SWILENA_PATH"
require "swilena_image2d"
-require "swilena_ntg_int_u"
+require "swilena_ntg"
require "swilena_display"
-include Swilena_ntg_int_u
+include Swilena_ntg
include Swilena_image2d
display = SwilenaDisplay.new
@@ -15,23 +15,15 @@
display.tmpdir = "/tmp/swilena"
display.display_command = "display %{image_file}"
-ima = Image2d_u8.new(5,5)
+ima = Image2d_uint.new(5,5)
-0.upto(5) do |i|
- 0.upto(5) do |j|
- ima.set(i, j, Int_u8.new(i + j))
+for i in 0..5 do
+ for j in 0..5 do
+ ima.set(i, j, Uint.new(i + j))
end
end
print ima
display.display_image (ima, "image1")
-ima2 = Image2d_u16.new(10, 10)
-0.upto(5) do |i|
- 0.upto(5) do |j|
- ima2.set(i, j, Int_u16.new(1))
- end
-end
-display.display_image (ima2, "image2")
-
display.wait_all_displays()
Index: tools/swilena/doc/examples/python/simple.py
--- tools/swilena/doc/examples/python/simple.py Mon, 22 Sep 2003 00:41:25 +0200 burrus_n (oln/v/23_simple.py 1.1 600)
+++ tools/swilena/doc/examples/python/simple.py Sat, 27 Sep 2003 19:02:23 +0200 burrus_n (oln/v/23_simple.py 1.2 600)
@@ -3,24 +3,24 @@
# Add swilena modules path into the PYTHON_PATH variable
from swilena_image2d import *
-from swilena_ntg_int_u import *
+from swilena_ntg import *
import swilena_display
from swilena_display import display_image, wait_all_displays
swilena_display.tmpdir = "/tmp/swilena"
swilena_display.display_command = "xv %{image_file}"
-ima = image2d_u8(5,5)
+ima = image2d_uint(5,5)
print ima.at(5,5).value()
-ima.set(2,2,int_u8(2))
+ima.set(2,2,uint(2))
print ima
p = ima.ref(1,1)
p.value(3)
print ima
-lena = image2d_u8();
+lena = image2d_uint();
lena.load("lena.pgm")
display_image (ima, "lena")
Index: tools/swilena/generate_morpho_instantiations.py
--- tools/swilena/generate_morpho_instantiations.py Mon, 29 Sep 2003 09:56:29 +0200 burrus_n ()
+++ tools/swilena/generate_morpho_instantiations.py Sat, 27 Sep 2003 19:02:23 +0200 burrus_n (oln/v/24_generate_m 1.1 700)
@@ -0,0 +1,149 @@
+#!/usr/bin/env python
+
+files = []
+
+def close_files():
+ for file in files:
+ file.close()
+
+def open_files():
+ for dim in range(1, 4):
+ files.append(open("swilena_morpho%(dim)sd.i" % vars(), 'w'))
+
+def write_headers():
+ for dim in range(1, 4):
+ file = files[dim - 1]
+ file.write("""// Note: this file was generated by generate_morpho.py.
+
+%%module swilena_morpho%(dim)sd
+
+%%include swilena_exception.i
+%%include swilena_morpho.i
+
+%%import swilena_image%(dim)sd.i
+%%import swilena_ntg.i
+
+""" % vars())
+
+def instantiate(dim, algorithm, *args):
+ file = files[dim - 1]
+ swilena_algorithm = "my_" + algorithm
+ params = args[0]
+ for param in args[1:]:
+ params += ", " + param
+ file.write(
+ "%%template(%(algorithm)s) %(swilena_algorithm)s< %(params)s >;\n"
+ % vars())
+
+def write_algorithms():
+ # Algorithms with all types and all dims
+ for dim in range(1, 4):
+ for type in [ "ntg_bin", "ntg_uint", "ntg_sint", "ntg_float" ]:
+ img_type = "::oln::image%(dim)sd< %(type)s >" % vars()
+ win_type = "::oln::window%(dim)sd" % vars()
+ neighb_type = "::oln::neighborhood%(dim)sd" % vars()
+
+ # FIXME: these algorithms do not work with floats
+ if type != "ntg_float":
+ instantiate(dim, "erosion", img_type, img_type, win_type)
+ instantiate(dim, "fast_erosion", img_type, img_type, win_type)
+
+ instantiate(dim, "dilation", img_type, img_type, win_type)
+ instantiate(dim, "fast_dilation", img_type, img_type, win_type)
+
+ instantiate(dim, "thickening", img_type, img_type, win_type, win_type)
+ instantiate(dim, "fast_thickening", img_type, img_type, win_type, win_type)
+
+ instantiate(dim, "thinning", img_type, img_type, win_type, win_type)
+ instantiate(dim, "fast_thinning", img_type, img_type, win_type, win_type)
+
+ instantiate(dim, "geodesic_erosion", img_type, img_type, img_type, neighb_type)
+ instantiate(dim, "sure_geodesic_erosion", img_type, img_type, img_type, neighb_type)
+
+ instantiate(dim, "geodesic_dilation", img_type, img_type, img_type, neighb_type)
+ instantiate(dim, "sure_geodesic_dilation", img_type, img_type, img_type, neighb_type)
+
+ instantiate(dim, "sure_geodesic_reconstruction_dilation", img_type, img_type, img_type, neighb_type)
+ instantiate(dim, "sequential_geodesic_reconstruction_dilation", img_type, img_type, img_type, neighb_type)
+ instantiate(dim, "hybrid_geodesic_reconstruction_dilation", img_type, img_type, img_type, neighb_type)
+
+ instantiate(dim, "sure_geodesic_reconstruction_erosion", img_type, img_type, img_type, neighb_type)
+ instantiate(dim, "sequential_geodesic_reconstruction_erosion", img_type, img_type, img_type, neighb_type)
+ instantiate(dim, "hybrid_geodesic_reconstruction_erosion", img_type, img_type, img_type, neighb_type)
+
+ instantiate(dim, "hit_or_miss", img_type, img_type, win_type, win_type)
+ instantiate(dim, "fast_hit_or_miss", img_type, img_type, win_type, win_type)
+
+ instantiate(dim, "hit_or_miss_opening", img_type, img_type, win_type, win_type)
+ instantiate(dim, "fast_hit_or_miss_opening", img_type, img_type, win_type, win_type)
+
+ instantiate(dim, "hit_or_miss_opening_bg", img_type, img_type, win_type, win_type)
+ instantiate(dim, "fast_hit_or_miss_opening_bg", img_type, img_type, win_type, win_type)
+
+ instantiate(dim, "hit_or_miss_closing", img_type, img_type, win_type, win_type)
+ instantiate(dim, "fast_hit_or_miss_closing", img_type, img_type, win_type, win_type)
+
+ instantiate(dim, "hit_or_miss_closing_bg", img_type, img_type, win_type, win_type)
+ instantiate(dim, "fast_hit_or_miss_closing_bg", img_type, img_type, win_type, win_type)
+
+ # FIXME: these algorithms do not work with binary types
+ if type != "ntg_bin" and type != "ntg_float":
+ instantiate(dim, "beucher_gradient", img_type, img_type, win_type)
+ instantiate(dim, "fast_beucher_gradient", img_type, img_type, win_type)
+
+ instantiate(dim, "internal_gradient", img_type, img_type, win_type)
+ instantiate(dim, "fast_internal_gradient", img_type, img_type, win_type)
+
+ instantiate(dim, "external_gradient", img_type, img_type, win_type)
+ instantiate(dim, "fast_external_gradient", img_type, img_type, win_type)
+
+ instantiate(dim, "white_top_hat", img_type, img_type, win_type)
+ instantiate(dim, "fast_white_top_hat", img_type, img_type, win_type)
+
+ instantiate(dim, "black_top_hat", img_type, img_type, win_type)
+ instantiate(dim, "fast_black_top_hat", img_type, img_type, win_type)
+
+ instantiate(dim, "self_complementary_top_hat", img_type, img_type, win_type)
+ instantiate(dim, "fast_self_complementary_top_hat", img_type, img_type, win_type)
+
+ instantiate(dim, "top_hat_contrast_op", img_type, img_type, win_type)
+ instantiate(dim, "fast_top_hat_contrast_op", img_type, img_type, win_type)
+
+ # FIXME: watershed only works with ntg_uint
+ if type == "ntg_uint":
+ # Watershed
+ img_ret_type = "::oln::image%(dim)sd< ntg_uint >" % vars()
+ instantiate(dim, "watershed_seg", img_ret_type, img_type, neighb_type)
+ instantiate(dim, "watershed_con", img_ret_type, img_type, neighb_type)
+ instantiate(dim, "watershed_seg_or", img_type, img_type, img_ret_type, neighb_type)
+
+ # FIXME: this is broken
+ # instantiate(dim, "laplacian", img_type, img_type, win_type)
+ # instantiate(dim, "fast_laplacian", img_type, img_type, win_type)
+
+ # FIXME: this is broken
+ # bin_img_type = "::oln::image%(dim)sd< ntg_bin >" % vars()
+ # instantiate(dim, "sure_minima_imposition", img_type, img_type, bin_img_type, neighb_type)
+ # instantiate(dim, "sequential_minima_imposition", img_type, img_type, bin_img_type, neighb_type)
+ # instantiate(dim, "hybrid_minima_imposition", img_type, img_type, bin_img_type, neighb_type)
+
+ # FIXME: this is broken
+ # instantiate(dim, "sure_regional_minima", bin_img_type, img_type, neighb_type)
+ # instantiate(dim, "sequential_regional_minima", bin_img_type, img_type, neighb_type)
+ # instantiate(dim, "hybrid_regional_minima", bin_img_type, img_type, neighb_type)
+
+ # Extrema killers
+ # FIXME: extrema killers work only with ntg::int_u8 data type
+ # instantiate(dim, "sure_maxima_killer", img_type, neighb_type)
+ # instantiate(dim, "fast_maxima_killer", img_type, neighb_type)
+ # instantiate(dim, "sure_minima_killer", img_type, neighb_type)
+ # instantiate(dim, "fast_minima_killer", img_type, neighb_type)
+
+def main():
+ open_files()
+ write_headers()
+ write_algorithms()
+ close_files()
+
+if __name__ == "__main__":
+ main()
Index: tools/swilena/meta/swilena_ntg_int_u.i
--- tools/swilena/meta/swilena_ntg_int_u.i Sun, 21 Sep 2003 21:59:21 +0200 burrus_n (oln/s/30_swilena_nt 1.2 640)
+++ tools/swilena/meta/swilena_ntg_int_u.i Mon, 29 Sep 2003 09:56:29 +0200 burrus_n ()
@@ -1,41 +0,0 @@
-%module swilena_ntg_int_u
-%include swilena_exception.i
-
-%import swilena_ntg.i
-
-%{
-#include <ntg/all.hh>
-%}
-
-%define declare_int_u(Name, nbits, behavior)
-
-%template(Name) ntg::int_u<nbits, behavior>;
-
-/*
- This macro should be used in all modules
- Using ntg::int_u8 directly leads to type matching problems:
-
- - it is a typedef never used in module swilena_ntg_int_u
- => no type correspondence is created between ntg::int_u8
- and ntg::int_u<8, ntg::strict>.
-
- - if another module use ntg::int_u8, operations on it won't be
- possible since this module won't recognize the type ntg::int_u8.
-
- - ntg::int_u<8, ntg::strict> or ntg_int_u8 should be used
- everywhere. ntg_int_u8 is just a convenient macro.
-*/
-
-#define ntg_ ## Name ntg::int_u<nbits, behavior>
-
-%enddef
-
-declare_int_u(int_u8, 8, ntg::strict);
-declare_int_u(int_u8u, 8, ntg::unsafe);
-declare_int_u(int_u8s, 8, ntg::saturate);
-declare_int_u(int_u16, 16, ntg::strict);
-declare_int_u(int_u16u, 16, ntg::unsafe);
-declare_int_u(int_u16s, 16, ntg::saturate);
-declare_int_u(int_u32, 32, ntg::strict);
-declare_int_u(int_u32u, 32, ntg::unsafe);
-declare_int_u(int_u32s, 32, ntg::saturate);
Index: tools/swilena/meta/swilena_ntg_int_s.i
--- tools/swilena/meta/swilena_ntg_int_s.i Sun, 21 Sep 2003 21:59:21 +0200 burrus_n (oln/s/31_swilena_nt 1.2 640)
+++ tools/swilena/meta/swilena_ntg_int_s.i Mon, 29 Sep 2003 09:56:29 +0200 burrus_n ()
@@ -1,27 +0,0 @@
-%module swilena_ntg_int_s
-%include swilena_exception.i
-
-%import swilena_ntg.i
-
-%{
-#include <ntg/all.hh>
-%}
-
-%define declare_int_s(Name, nbits, behavior)
-
-%template(Name) ntg::int_s<nbits, behavior>;
-
-// See comments in swilena_ntg_int_u.i
-#define ntg_ ## Name ntg::int_s<nbits, behavior>
-
-%enddef
-
-declare_int_s(int_s8, 8, ntg::strict);
-declare_int_s(int_s8u, 8, ntg::unsafe);
-declare_int_s(int_s8s, 8, ntg::saturate);
-declare_int_s(int_s16, 16, ntg::strict);
-declare_int_s(int_s16u, 16, ntg::unsafe);
-declare_int_s(int_s16s, 16, ntg::saturate);
-declare_int_s(int_s32, 32, ntg::strict);
-declare_int_s(int_s32u, 32, ntg::unsafe);
-declare_int_s(int_s32s, 32, ntg::saturate);
Index: tools/swilena/meta/swilena_ntg_cplx.i
--- tools/swilena/meta/swilena_ntg_cplx.i Sun, 21 Sep 2003 21:59:21 +0200 burrus_n (oln/s/32_swilena_nt 1.3 640)
+++ tools/swilena/meta/swilena_ntg_cplx.i Mon, 29 Sep 2003 09:56:29 +0200 burrus_n ()
@@ -1,23 +0,0 @@
-%module swilena_ntg_cplx
-%include swilena_exception.i
-
-%import swilena_ntg.i
-
-%{
-#include <ntg/all.hh>
-%}
-
-%define declare_cplx(Name, repr, T)
-
-%template(Name) ntg::cplx<repr, T>;
-
-// See comments in swilena_ntg_int_u.i
-#define ntg_ ## Name ntg::cplx<repr, T>
-
-%enddef
-
-
-declare_cplx(cplx_rf, ntg::rect, ntg_float_s);
-declare_cplx(cplx_rd, ntg::rect, ntg_float_d);
-declare_cplx(cplx_pf, ntg::polar, ntg_float_s);
-declare_cplx(cplx_pd, ntg::polar, ntg_float_d);
1
0
Index: olena/ChangeLog
from Nicolas Burrus <burrus_n(a)lrde.epita.fr>
* oln/io/pnm_write_2d.hh: Fix int_u32 images writing.
Index: olena/oln/io/pnm_write_2d.hh
--- olena/oln/io/pnm_write_2d.hh Thu, 07 Aug 2003 02:37:23 +0200 burrus_n (oln/u/44_pnm_write_ 1.3 600)
+++ olena/oln/io/pnm_write_2d.hh Sat, 27 Sep 2003 18:30:39 +0200 burrus_n (oln/u/44_pnm_write_ 1.4 600)
@@ -126,9 +126,6 @@
static bool
write(std::ostream& out, const I& im)
{
- if (ntg_max_val(oln_value_type(I)) > ntg::to_ntg(65535U))
- return false;
-
pnm2d_info info;
info.cols = im.ncols();
info.rows = im.nrows();
@@ -136,6 +133,9 @@
traverse(f, im);
info.max_val = f.max();
+ if (info.max_val > ntg::to_ntg(65535U))
+ return false;
+
if (!pnm_write_header2d(out, pnm_id, info))
return false;
1
0
on reprend les reunions olena la semaine prochaine,
regardez votre emploi du temps de la semaine prochaine et
annoncez vos possibilites :
pour l'instant david propose le jeudi 02/10 (apres la fin de yjd)
alors si c'est ok pour cette date :
reunion a 14h00
1
0
Ca va aider swilena a rester fonctionnelle un peu plus longtemps
j'espère.
Index: ChangeLog
from Nicolas Burrus <burrus_n(a)lrde.epita.fr>
* configure.ac: Generate makefiles for swilena tests.
+2003-09-21 Nicolas Burrus <burrus_n(a)lrde.epita.fr>
+
* configure.ac: Add ruby support.
2003-09-15 Nicolas Burrus <burrus_n(a)lrde.epita.fr>
Index: tools/swilena/ChangeLog
from Nicolas Burrus <burrus_n(a)lrde.epita.fr>
* expand.sh: Generate makefile.swig files instead of Makefile.am.
* python/Makefile: New file.
* python/tests/Makefile.am: New file.
* python/tests/simple1.py: New test.
* ruby/Makefile: New file.
* ruby/tests/Makefile.am: New file.
* ruby/tests/simple1.rb: New test.
+2003-09-21 Nicolas Burrus <burrus_n(a)lrde.epita.fr>
+
* meta/swilena_ntg_int_u.i: Fix type matching problems between
templates and typedefs.
* meta/swilena_ntg_int_s.i: Likewise.
Index: configure.ac
--- configure.ac Sun, 21 Sep 2003 20:25:01 +0200 burrus_n (oln/3_configure. 1.47.1.1.1.1.1.4.1.15.1.11 640)
+++ configure.ac Sun, 21 Sep 2003 23:13:48 +0200 burrus_n (oln/3_configure. 1.47.1.1.1.1.1.4.1.15.1.12 640)
@@ -360,7 +360,8 @@
[oln_cv_build_pylena],
[the Python interface to Olena],
[OLN_SWILENA],
- [tools/swilena/python/Makefile],
+ [tools/swilena/python/Makefile
+ tools/swilena/python/tests/Makefile],
[
AM_PATH_PYTHON([2.1])
save_CPPFLAGS=$CPPFLAGS
@@ -383,7 +384,8 @@
[oln_cv_build_rblena],
[the Ruby interface to Olena],
[OLN_SWILENA],
- [tools/swilena/ruby/Makefile],
+ [tools/swilena/ruby/Makefile
+ tools/swilena/ruby/tests/Makefile],
[
AC_ARG_VAR([RUBY_CPPFLAGS], [Path to ruby.h])
AC_ARG_WITH([python-includedir], [Include path for ruby.h],
Index: tools/swilena/expand.sh
--- tools/swilena/expand.sh Sun, 21 Sep 2003 20:25:01 +0200 burrus_n (oln/s/25_expand.sh 1.7 750)
+++ tools/swilena/expand.sh Sun, 21 Sep 2003 23:13:48 +0200 burrus_n (oln/s/25_expand.sh 1.8 750)
@@ -113,7 +113,7 @@
cat <<EOF
## Process this file through Automake to produce Makefile.in -*- Makefile -*-
##
-## Makefile.am for swilena/python
+## Makefile.am for swilena/ruby
## NOTE: this file was generated automatically by expand.sh
##
@@ -197,9 +197,9 @@
############ Output ###############
-header_src >"$SWILENA/src/Makefile.am"
-dump_src >>"$SWILENA/src/Makefile.am"
-header_python >"$SWILENA/python/Makefile.am"
-dump_python >>"$SWILENA/python/Makefile.am"
-header_ruby >"$SWILENA/ruby/Makefile.am"
-dump_ruby >>"$SWILENA/ruby/Makefile.am"
+header_src >"$SWILENA/src/makefile.swig"
+dump_src >>"$SWILENA/src/makefile.swig"
+header_python >"$SWILENA/python/makefile.swig"
+dump_python >>"$SWILENA/python/makefile.swig"
+header_ruby >"$SWILENA/ruby/makefile.swig"
+dump_ruby >>"$SWILENA/ruby/makefile.swig"
Index: tools/swilena/python/tests/Makefile.am
--- tools/swilena/python/tests/Makefile.am Mon, 22 Sep 2003 00:50:52 +0200 burrus_n ()
+++ tools/swilena/python/tests/Makefile.am Sun, 21 Sep 2003 23:13:48 +0200 burrus_n (oln/v/15_Makefile.a 1.1 600)
@@ -0,0 +1,10 @@
+## Process this file through Automake to produce Makefile.in -*- Makefile -*-
+##
+## Makefile.am for swilena/python/tests
+##
+
+TESTS_ENVIRONMENT = \
+ PYTHONPATH="$(PYTHONPATH):.." \
+ IMGDIR="$(top_srcdir)/olena/img"
+
+TESTS = simple1.py
Index: tools/swilena/python/tests/simple1.py
--- tools/swilena/python/tests/simple1.py Mon, 22 Sep 2003 00:50:52 +0200 burrus_n ()
+++ tools/swilena/python/tests/simple1.py Sun, 21 Sep 2003 23:13:48 +0200 burrus_n (oln/v/16_simple1.py 1.1 700)
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+
+import os
+import sys
+from swilena_image2d import *
+from swilena_ntg_int_u import *
+
+imgdir = os.environ['IMGDIR']
+
+lena = image2d_u8()
+lena.load(imgdir + "/lena.pgm")
+# FIXME: uncomment when ready
+#assert(lena.has_impl())
+
+lena.set(5, 5, int_u8(51))
+lena.ref(6, 6).value(42)
+
+assert(lena.at(5, 5).value() == 51)
+assert(lena.at(6, 6).value() == 42)
Index: tools/swilena/ruby/Makefile.am
--- tools/swilena/ruby/Makefile.am Mon, 22 Sep 2003 00:50:52 +0200 burrus_n ()
+++ tools/swilena/ruby/Makefile.am Sun, 21 Sep 2003 23:13:48 +0200 burrus_n (oln/v/17_Makefile.a 1.1 600)
@@ -0,0 +1,8 @@
+## Process this file through Automake to produce Makefile.in -*- Makefile -*-
+##
+## Makefile.am for swilena/python
+##
+
+SUBDIRS = . tests
+
+include makefile.swig
Index: tools/swilena/ruby/tests/Makefile.am
--- tools/swilena/ruby/tests/Makefile.am Mon, 22 Sep 2003 00:50:52 +0200 burrus_n ()
+++ tools/swilena/ruby/tests/Makefile.am Sun, 21 Sep 2003 23:13:48 +0200 burrus_n (oln/v/18_Makefile.a 1.1 600)
@@ -0,0 +1,10 @@
+## Process this file through Automake to produce Makefile.in -*- Makefile -*-
+##
+## Makefile.am for swilena/python/tests
+##
+
+TESTS_ENVIRONMENT = \
+ SWILENA_PATH=".." \
+ IMGDIR="$(top_srcdir)/olena/img"
+
+TESTS = simple1.rb
Index: tools/swilena/ruby/tests/simple1.rb
--- tools/swilena/ruby/tests/simple1.rb Mon, 22 Sep 2003 00:50:52 +0200 burrus_n ()
+++ tools/swilena/ruby/tests/simple1.rb Sun, 21 Sep 2003 23:13:48 +0200 burrus_n (oln/v/19_simple1.rb 1.1 700)
@@ -0,0 +1,23 @@
+#!/usr/bin/env ruby
+
+# Set swilena_path to the location where swilena ruby modules are
+$: << ENV["SWILENA_PATH"] if ENV.has_key? "SWILENA_PATH"
+
+require "swilena_image2d"
+require "swilena_ntg_int_u"
+
+include Swilena_ntg_int_u
+include Swilena_image2d
+
+imgdir = ENV["IMGDIR"]
+
+lena = Image2d_u8.new
+lena.load(imgdir + "/lena.pgm")
+# FIXME: uncomment when ready
+#exit 1 unless lena.has_impl()
+
+lena.set(5, 5, Int_u8.new(51))
+lena.ref(6, 6).value(42)
+
+exit 1 unless lena.at(5, 5).value() == 51
+exit 1 unless lena.at(6, 6).value() == 42
2
3
swilena_display permet d'afficher des images olena dans son viewer
favori depuis l'interpréteur python ou ruby.
Je n'ai pas retrouvé comment faire pour installer un repertoire entier
proprement avec automake :( Qqn peut m'aider ?
Index: tools/swilena/ChangeLog
from Nicolas Burrus <burrus_n(a)lrde.epita.fr>
* doc/examples/ruby/simple.rb: New example.
* doc/examples/python/simple.py: New example.
* doc/Makefile.am: Distribute examples.
* ruby/swilena_display.rb: New file.
* ruby/Makefile.am: Install swilena_display.rb
* python/swilena_display.py: New file.
* python/Makefile.am: Install swilena_display.py.
* expand.sh: Adjust.
Index: tools/swilena/doc/Makefile.am
--- tools/swilena/doc/Makefile.am Tue, 18 Feb 2003 12:56:06 +0100 raph (oln/n/39_Makefile.a 1.2 640)
+++ tools/swilena/doc/Makefile.am Mon, 22 Sep 2003 00:41:25 +0200 burrus_n (oln/n/39_Makefile.a 1.3 640)
@@ -1,4 +1,5 @@
-
+# FIXME: install the examples somewhere
+EXTRA_DIST = examples
dist_noinst_DATA = swilena.dvi swilena.pdf
info_TEXINFOS = swilena.texi
Index: tools/swilena/expand.sh
--- tools/swilena/expand.sh Sun, 21 Sep 2003 23:13:48 +0200 burrus_n (oln/s/25_expand.sh 1.8 750)
+++ tools/swilena/expand.sh Mon, 22 Sep 2003 00:41:25 +0200 burrus_n (oln/s/25_expand.sh 1.9 750)
@@ -79,7 +79,7 @@
ilist=`expr $ilist + 1`
done
echo; echo
- echo -n "python_PYTHON ="
+ echo -n "python_PYTHON +="
ilist=0
for mod in $MODULES; do
if [ `expr $ilist % 4` = 0 ]; then
@@ -122,8 +122,6 @@
AM_CXXFLAGS = \$(CXXFLAGS_OPTIMIZE)
AM_LDFLAGS = -shared -lswigrb \$(ZLIB_LDFLAGS)
-rubydir = \$(libdir)/ruby
-
EOF
}
@@ -139,16 +137,6 @@
ilist=`expr $ilist + 1`
done
echo; echo
- echo -n "ruby_DATA ="
- ilist=0
- for mod in $MODULES; do
- if [ `expr $ilist % 4` = 0 ]; then
- echo " \\"; echo -ne "\t"
- fi
- echo -n " swilena_$mod.rb"
- ilist=`expr $ilist + 1`
- done
- echo; echo
for mod in $MODULES; do
echo "swilena_${mod}_so_SOURCES = swilena_${mod}_wrap.cxx"
done
@@ -160,7 +148,7 @@
else
sdir=meta
fi
- echo "swilena_${mod}_wrap.cxx swilena_${mod}.rb: \$(srcdir)/../$sdir/swilena_${mod}.i"
+ echo "swilena_${mod}_wrap.cxx: \$(srcdir)/../$sdir/swilena_${mod}.i"
echo -e "\t\$(SWIG) -c -c++ -ruby -I\$(srcdir)/../src -I\$(srcdir)/../meta \$(CPPFLAGS) -o swilena_${mod}_wrap.cxx \$(srcdir)/../$sdir/swilena_${mod}.i"
echo
done
Index: tools/swilena/ruby/Makefile.am
--- tools/swilena/ruby/Makefile.am Sun, 21 Sep 2003 23:13:48 +0200 burrus_n (oln/v/17_Makefile.a 1.1 600)
+++ tools/swilena/ruby/Makefile.am Mon, 22 Sep 2003 00:41:25 +0200 burrus_n (oln/v/17_Makefile.a 1.2 600)
@@ -5,4 +5,8 @@
SUBDIRS = . tests
+rubydir = $(libdir)/ruby
+
+ruby_DATA = swilena_display.rb
+
include makefile.swig
Index: tools/swilena/python/swilena_display.py
--- tools/swilena/python/swilena_display.py Mon, 22 Sep 2003 00:59:33 +0200 burrus_n ()
+++ tools/swilena/python/swilena_display.py Mon, 22 Sep 2003 00:41:25 +0200 burrus_n (oln/v/20_swilena_di 1.1 600)
@@ -0,0 +1,24 @@
+import string
+import commands
+from threading import Thread
+
+display_command = "display %{image_file}"
+tmpdir = "/tmp"
+threads = []
+
+def launch_image_viewer(image):
+ command = string.replace(display_command, "%{image_file}", image)
+ status, output = commands.getstatusoutput(command)
+ if status != 0:
+ print "Error while running `%s'!\n" % command
+
+def display_image(oln_image, name):
+ image_file = tmpdir + "/" + name
+ oln_image.save(image_file)
+ new_thread = Thread(target=launch_image_viewer,
+ args = (image_file,))
+ new_thread.start()
+ threads.append(new_thread)
+
+def wait_all_displays():
+ [thread.join() for thread in threads]
Index: tools/swilena/ruby/swilena_display.rb
--- tools/swilena/ruby/swilena_display.rb Mon, 22 Sep 2003 00:59:33 +0200 burrus_n ()
+++ tools/swilena/ruby/swilena_display.rb Mon, 22 Sep 2003 00:41:25 +0200 burrus_n (oln/v/21_swilena_di 1.1 700)
@@ -0,0 +1,28 @@
+class SwilenaDisplay
+
+ attr_writer :display_command, :tmpdir
+ attr_reader :display_command, :tmpdir
+
+ def initialize
+ @threads = []
+ @display_command = "display %{image_file}"
+ @tmpdir = "/tmp"
+ end
+
+ def launch_image_viewer(image)
+ command = @display_command.gsub("%{image_file}", image)
+ `#{command}`
+ print "Error while running `#{command}'\n" if $? != 0
+ end
+
+ def display_image(oln_image, name)
+ image_file = @tmpdir + "/" + name
+ oln_image.save(image_file)
+ @threads << Thread.new { launch_image_viewer(image_file) }
+ end
+
+ def wait_all_displays
+ @threads.each { |thread| thread.join }
+ end
+
+end
Index: tools/swilena/doc/examples/ruby/simple.rb
--- tools/swilena/doc/examples/ruby/simple.rb Mon, 22 Sep 2003 00:59:33 +0200 burrus_n ()
+++ tools/swilena/doc/examples/ruby/simple.rb Mon, 22 Sep 2003 00:41:25 +0200 burrus_n (oln/v/22_simple.rb 1.1 600)
@@ -0,0 +1,37 @@
+#!/usr/bin/env ruby
+
+# Set swilena_path to the location where swilena ruby modules are
+$: << ENV["SWILENA_PATH"] if ENV.has_key? "SWILENA_PATH"
+
+require "swilena_image2d"
+require "swilena_ntg_int_u"
+require "swilena_display"
+
+include Swilena_ntg_int_u
+include Swilena_image2d
+
+display = SwilenaDisplay.new
+
+display.tmpdir = "/tmp/swilena"
+display.display_command = "display %{image_file}"
+
+ima = Image2d_u8.new(5,5)
+
+0.upto(5) do |i|
+ 0.upto(5) do |j|
+ ima.set(i, j, Int_u8.new(i + j))
+ end
+end
+
+print ima
+display.display_image (ima, "image1")
+
+ima2 = Image2d_u16.new(10, 10)
+0.upto(5) do |i|
+ 0.upto(5) do |j|
+ ima2.set(i, j, Int_u16.new(1))
+ end
+end
+display.display_image (ima2, "image2")
+
+display.wait_all_displays()
Index: tools/swilena/doc/examples/python/simple.py
--- tools/swilena/doc/examples/python/simple.py Mon, 22 Sep 2003 00:59:33 +0200 burrus_n ()
+++ tools/swilena/doc/examples/python/simple.py Mon, 22 Sep 2003 00:41:25 +0200 burrus_n (oln/v/23_simple.py 1.1 600)
@@ -0,0 +1,29 @@
+#!/usr/bin/env python
+
+# Add swilena modules path into the PYTHON_PATH variable
+
+from swilena_image2d import *
+from swilena_ntg_int_u import *
+import swilena_display
+from swilena_display import display_image, wait_all_displays
+
+swilena_display.tmpdir = "/tmp/swilena"
+swilena_display.display_command = "xv %{image_file}"
+
+ima = image2d_u8(5,5)
+print ima.at(5,5).value()
+
+ima.set(2,2,int_u8(2))
+print ima
+
+p = ima.ref(1,1)
+p.value(3)
+print ima
+
+lena = image2d_u8();
+lena.load("lena.pgm")
+
+display_image (ima, "lena")
+display_image (lena, "lena2")
+
+wait_all_displays()
1
0