SourceForge: enblend/enblend: changeset 597:af0a40a346e7
Accept response files in addition to plain image files.
authorDr. Christoph L. Spiel <cspiel@freenet.de>
Fri Nov 06 09:42:01 2009 +0100 (2 weeks ago)
changeset 597af0a40a346e7
parent 596f2451287ddf1
child 598882223824422
Accept response files in addition to plain image files.
Use the tried-and-true syntax of many linkers:
Filenames prefixed by an '@' are response files.
Expand them recursively in a depth-first manner.

This implements SourcForge feature request ID: 2881286.
NEWS
VERSION
doc/Makefile.am
doc/enblend.info
doc/enblend.texi
doc/enfuse.info
doc/enfuse.texi
doc/filespec.texi
doc/versenblend.texi
doc/versenfuse.texi
src/Makefile.am
src/common.h
src/enblend.cc
src/enblend.h
src/enblend_msvc2008.vcproj
src/enfuse.cc
src/enfuse.h
src/enfuse_msvc2008.vcproj
src/error_message.cc
src/error_message.h
src/filenameparse.cc
src/filenameparse.h
src/filespec.cc
src/filespec.h
src/global.h
src/mask.h
     1.1 --- a/NEWS	Tue Nov 03 13:56:24 2009 +0100
     1.2 +++ b/NEWS	Fri Nov 06 09:42:01 2009 +0100
     1.3 @@ -20,6 +20,10 @@
     1.4    ("--disable-image-cache").  Speedups of up to 30% have been reported
     1.5    on the amd64 architecture.
     1.6  
     1.7 +- Enblend and Enfuse accept repsonse files in addition to literal
     1.8 +  image files.  Response files contain lists of image filenames or
     1.9 +  names of other response files.
    1.10 +
    1.11  - Lots of new warnings if a command-line option has no effect, like,
    1.12    for example, combining a mask optimization option with
    1.13    "--no-optimize".
     2.1 --- a/VERSION	Tue Nov 03 13:56:24 2009 +0100
     2.2 +++ b/VERSION	Fri Nov 06 09:42:01 2009 +0100
     2.3 @@ -1,1 +1,1 @@
     2.4 -4.0-ea0c41a98dcc
     2.5 +4.0-f2451287ddf1
     3.1 --- a/doc/Makefile.am	Tue Nov 03 13:56:24 2009 +0100
     3.2 +++ b/doc/Makefile.am	Fri Nov 06 09:42:01 2009 +0100
     3.3 @@ -7,7 +7,7 @@
     3.4                     helpful-programs.texi \
     3.5                     tuning-memory-usage.texi \
     3.6                     understanding-masks.texi \
     3.7 -                   workflow.texi \
     3.8 +                   workflow.texi filespec.texi \
     3.9                     bug-reports.texi authors.texi \
    3.10                     photographic-workflow.fig \
    3.11                     default.css
    3.12 @@ -18,7 +18,7 @@
    3.13                    helpful-programs.texi \
    3.14                    tuning-memory-usage.texi \
    3.15                    understanding-masks.texi \
    3.16 -                  workflow.texi \
    3.17 +                  workflow.texi filespec.texi \
    3.18                    bug-reports.texi authors.texi \
    3.19                    config-edge.gp config.gp \
    3.20                    entropy-cutoff.gp.in \
     4.1 --- a/doc/enblend.info	Tue Nov 03 13:56:24 2009 +0100
     4.2 +++ b/doc/enblend.info	Fri Nov 06 09:42:01 2009 +0100
     4.3 @@ -27,7 +27,7 @@
     4.4  Enblend
     4.5  *******
     4.6  
     4.7 -This manual is for Enblend (version 4.0-dd32463fe9de, 31 October 2009),
     4.8 +This manual is for Enblend (version 4.0-dd32463fe9de, 5 November 2009),
     4.9  a tool for compositing images in such a way that the seam between the
    4.10  images is invisible, or at least very difficult to see.
    4.11  
    4.12 @@ -180,6 +180,118 @@
    4.13  
    4.14  Assemble the sequence of images INPUT... into a single IMAGE.
    4.15  
    4.16 +   Input images are either specified literally or via so-called response
    4.17 +files.  A response file contains filenames of images or other response
    4.18 +filenames.  Introduce response file names with an at-character (`@').
    4.19 +
    4.20 +   Enblend and Enfuse process the list INPUT... from left to right,
    4.21 +expanding response files depth-first.  The following examples only show
    4.22 +Enblend, but Enfuse works exactly the same.
    4.23 +
    4.24 +Solely literal filenames.
    4.25 +     Example:
    4.26 +          enblend image-1.tif image-2.tif image-3.tif
    4.27 +
    4.28 +     The ultimate order in which the images are processed is:
    4.29 +     `image-1.tif', `image-2.tif', `image-3.tif'.
    4.30 +
    4.31 +Single response file.
    4.32 +     Example:
    4.33 +          enblend @list
    4.34 +     where file `list' contains
    4.35 +          img1.exr
    4.36 +          img2.exr
    4.37 +          img3.exr
    4.38 +          img4.exr
    4.39 +
    4.40 +     Ultimate order: `img1.exr', `img2.exr', `img3.exr', `img4.exr'.
    4.41 +
    4.42 +Mixed literal names and response files.
    4.43 +     Example:
    4.44 +          enblend @master.list image-09.png image-10.png
    4.45 +     where file `master.list' comprises of
    4.46 +          image-01.png
    4.47 +          @first.list
    4.48 +          image-04.png
    4.49 +          @second.list
    4.50 +          image-08.png
    4.51 +     `first.list' is
    4.52 +          image-02.png
    4.53 +          image-03.png
    4.54 +     and `second.list' contains
    4.55 +          image-05.png
    4.56 +          image-06.png
    4.57 +          image-07.png
    4.58 +
    4.59 +     Ultimate order: `image-01.png', `image-02.png', `image-03.png',
    4.60 +     `image-04.png', `image-05.png', `image-06.png', `image-07.png',
    4.61 +     `image-08.png', `image-09.png', `image-10.png',
    4.62 +
    4.63 +
    4.64 +*Response File Format* Response files contain one filename per line.
    4.65 +Blank lines or lines beginning with a sharp sign (`#') are ignored.
    4.66 +Filenames that begin with an at-character (`@') denote other response
    4.67 +files.  *note Table:response-file-format:: states a formal grammar of
    4.68 +response files in EBNF (http://en.wikipedia.org/wiki/Ebnf).
    4.69 +
    4.70 +RESPONSE-FILE   ::=   LINE*
    4.71 +LINE            ::=   (COMMENT | FILE-SPEC) [`\r'] `\n'
    4.72 +COMMENT         ::=   SPACE* `#' TEXT
    4.73 +FILE-SPEC       ::=   SPACE* `@' FILENAME SPACE*
    4.74 +SPACE           ::=   ` ' | `\t'
    4.75 +
    4.76 +where TEXT is an arbitrary string and FILENAME is any filename.
    4.77 +
    4.78 +Table 3.1: EBNF definition of the grammar of response files.
    4.79 +
    4.80 +   In a response file all relative filenames are used relative the the
    4.81 +response file itself, not relative to the current-working directory of
    4.82 +the application.
    4.83 +
    4.84 +The above grammar might unpleasantly surprise the user in the some ways:
    4.85 +
    4.86 +Literal filenames
    4.87 +     Inside a response file all filenames are treated as literals.  No
    4.88 +     filename globing or expansion is performed.  This is, the line
    4.89 +          img_*.tif
    4.90 +     stands for exactly one file called `img_*.tif'.
    4.91 +
    4.92 +Whitespace trimmed at both line ends
    4.93 +     For convenience whitespace at the beginning and at the end of each
    4.94 +     line is ignored.  However, this implies that response files cannot
    4.95 +     represent filenames that start or end with whitespace, as there is
    4.96 +     no quoting syntax.  Filenames with embedded whatespace cause no
    4.97 +     problems, though.
    4.98 +
    4.99 +Only whole-line comments
   4.100 +     Comments in response files always occupy a complete line.  There
   4.101 +     are no line-ending comments.  Thus in
   4.102 +          # exposure series
   4.103 +          img-0.33ev.tif # "middle" EV
   4.104 +          img-1.33ev.tif
   4.105 +          img+0.67ev.tif
   4.106 +     only the first line contains a comment, whereas the second lines
   4.107 +     includes none.  Rather it refers to
   4.108 +     file `img-0.33ev.tif # "middle" EV'.
   4.109 +
   4.110 +Image filenames cannot start with `@'
   4.111 +     An at-sign always introduces a response file, even if the extension
   4.112 +     would hinto towards an image.
   4.113 +
   4.114 +Here is an example of a valid response file.
   4.115 +     # 4\pi panorama!
   4.116 +
   4.117 +     # These pictures were taken with the panorama head.
   4.118 +     @round-shots.list
   4.119 +
   4.120 +     # Freehand sky shot.
   4.121 +     zenith.tif
   4.122 +
   4.123 +     # "Legs, will you go away?" images.
   4.124 +     nadir-2.tif
   4.125 +     nadir-5.tif
   4.126 +     nadir.tif
   4.127 +
   4.128  3.1 Common Options
   4.129  ==================
   4.130  
   4.131 @@ -289,7 +401,7 @@
   4.132            mask generation, pyramid, and blending
   4.133  
   4.134      3
   4.135 -          color conversions
   4.136 +          reading of response files, color conversions
   4.137  
   4.138      4
   4.139            image sizes, bounding boxes and intersection sizes
   4.140 @@ -599,7 +711,7 @@
   4.141                                             algorithm, fill vector
   4.142                                             contours.
   4.143  
   4.144 -     Table 3.1: Various options that control the generation of masks.
   4.145 +     Table 3.2: Various options that control the generation of masks.
   4.146       All mask computations are based on the Nearest-Feature
   4.147       Transformation (NFT) of the overlap region.
   4.148  
   4.149 @@ -621,7 +733,7 @@
   4.150       seam line, which can be slow.  Use this option, for example, if
   4.151       you have very narrow overlap regions.
   4.152  
   4.153 -        Also see *note Table 3.1: Table:mask-generation.
   4.154 +        Also see *note Table 3.2: Table:mask-generation.
   4.155  
   4.156    `--load-masks[=IMAGE-TEMPLATE]'
   4.157          Instead of generating masks, use those in IMAGE-TEMPLATE.  The
   4.158 @@ -636,7 +748,7 @@
   4.159  
   4.160          If Enblend uses a coarse mask (`--coarse-mask') or Enblend
   4.161       optimizes (`--optimize') a mask it vectorizes the initial seam
   4.162 -     line before performing further operations.  See *note Table 3.1:
   4.163 +     line before performing further operations.  See *note Table 3.2:
   4.164       Table:mask-generation. for the precise conditions.  DISTANCE tells
   4.165       Enblend how long to make each of the line segments called vectors
   4.166       here.
   4.167 @@ -680,13 +792,13 @@
   4.168       Enblend version 2.5, namely the result of a Nearest-Feature
   4.169       Transform (NFT).(1)
   4.170  
   4.171 -        Also see *note Table 3.1: Table:mask-generation.
   4.172 +        Also see *note Table 3.2: Table:mask-generation.
   4.173  
   4.174    `--optimize'
   4.175          Use a two-strategy approach to route the seam line around
   4.176       mismatches in the overlap region.  This is the default.  *note
   4.177       Table:optimizer-strategies:: explains these strategies; also see
   4.178 -     *note Table 3.1: Table:mask-generation.
   4.179 +     *note Table 3.2: Table:mask-generation.
   4.180  
   4.181      Stragegy 1: Simulated Annealing
   4.182            Tune with option `--anneal' = TAU : DELTA-E-MAX : DELTA-E-MIN
   4.183 @@ -702,7 +814,7 @@
   4.184            (http://en.wikipedia.org/wiki/Dijkstra_algorithm)
   4.185  
   4.186  
   4.187 -     Table 3.2: Enblend's two strategies to optimize the seam lines
   4.188 +     Table 3.3: Enblend's two strategies to optimize the seam lines
   4.189       between images.
   4.190  
   4.191    `--optimizer-weights=DISTANCE-WEIGHT[:MISMATCH-WEIGHT]'
   4.192 @@ -832,7 +944,7 @@
   4.193      bright yellow
   4.194            Final seam line
   4.195  
   4.196 -     Table 3.3: Colors used in seam-line visualization images.
   4.197 +     Table 3.4: Colors used in seam-line visualization images.
   4.198  
   4.199  
   4.200  `%%'
   4.201 @@ -906,7 +1018,7 @@
   4.202  `%E'
   4.203       Is replaced with the extension of the output file.
   4.204  
   4.205 -Table 3.4: Special characters to control the generation of mask
   4.206 +Table 3.5: Special characters to control the generation of mask
   4.207  filenames.
   4.208  
   4.209     ---------- Footnotes ----------
   4.210 @@ -1750,245 +1862,252 @@
   4.211  Program Index
   4.212  *************
   4.213  
   4.214 -ale:                                           See 6.        (line 1099)
   4.215 -align_image_stack (Hugin):                     See 6.        (line 1106)
   4.216 -cinepaint <1>:                                 See 6.        (line 1118)
   4.217 -cinepaint:                                     See 3.2.      (line  484)
   4.218 -convert (ImageMagick):                         See 6.        (line 1129)
   4.219 -dcraw <1>:                                     See 6.        (line 1089)
   4.220 +ale:                                           See 6.        (line 1211)
   4.221 +align_image_stack (Hugin):                     See 6.        (line 1218)
   4.222 +cinepaint <1>:                                 See 6.        (line 1230)
   4.223 +cinepaint:                                     See 3.2.      (line  596)
   4.224 +convert (ImageMagick):                         See 6.        (line 1241)
   4.225 +dcraw <1>:                                     See 6.        (line 1201)
   4.226  dcraw:                                         See 2.        (line  102)
   4.227 -display (ImageMagick):                         See 6.        (line 1129)
   4.228 -exiftool:                                      See 6.        (line 1157)
   4.229 -exrdisplay (OpenEXR):                          See 6.        (line 1135)
   4.230 -fulla (Hugin):                                 See 6.        (line 1106)
   4.231 -gimp <1>:                                      See 6.        (line 1125)
   4.232 -gimp <2>:                                      See 3.2.      (line  484)
   4.233 +display (ImageMagick):                         See 6.        (line 1241)
   4.234 +exiftool:                                      See 6.        (line 1269)
   4.235 +exrdisplay (OpenEXR):                          See 6.        (line 1247)
   4.236 +fulla (Hugin):                                 See 6.        (line 1218)
   4.237 +gimp <1>:                                      See 6.        (line 1237)
   4.238 +gimp <2>:                                      See 3.2.      (line  596)
   4.239  gimp:                                          See 2.        (line  102)
   4.240 -gm (GraphicsMagick):                           See 6.        (line 1129)
   4.241 -hugin <1>:                                     See 6.        (line 1103)
   4.242 -hugin <2>:                                     See 3.2.      (line  475)
   4.243 +gm (GraphicsMagick):                           See 6.        (line 1241)
   4.244 +hugin <1>:                                     See 6.        (line 1215)
   4.245 +hugin <2>:                                     See 3.2.      (line  587)
   4.246  hugin <3>:                                     See 2.        (line  102)
   4.247  hugin:                                         See 1.        (line   56)
   4.248 -identify (ImageMagick) <1>:                    See 6.        (line 1129)
   4.249 -identify (ImageMagick):                        See 4.1.      (line  938)
   4.250 -montage (ImageMagick):                         See 6.        (line 1129)
   4.251 -nona (Hugin) <1>:                              See 6.        (line 1106)
   4.252 -nona (Hugin):                                  See 3.2.      (line  475)
   4.253 +identify (ImageMagick) <1>:                    See 6.        (line 1241)
   4.254 +identify (ImageMagick):                        See 4.1.      (line 1050)
   4.255 +montage (ImageMagick):                         See 6.        (line 1241)
   4.256 +nona (Hugin) <1>:                              See 6.        (line 1218)
   4.257 +nona (Hugin):                                  See 3.2.      (line  587)
   4.258  PanoTools <1>:                                 See 2.        (line  102)
   4.259  PanoTools:                                     See 1.        (line   56)
   4.260 -pfshdrcalibrate (PFScalibration):              See 6.        (line 1138)
   4.261 -pfsin (PFSTools):                              See 6.        (line 1138)
   4.262 -pfsout (PFSTools):                             See 6.        (line 1138)
   4.263 -pfstmo_* (PFStmo):                             See 6.        (line 1138)
   4.264 -pfsview (PFSTools):                            See 6.        (line 1138)
   4.265 -PTmender (PanoTools):                          See 6.        (line 1111)
   4.266 -PTOptimizer (PanoTools):                       See 6.        (line 1111)
   4.267 -tifficc (LittleCMS):                           See 6.        (line 1161)
   4.268 -tiffinfo (libtiff) <1>:                        See 6.        (line 1153)
   4.269 -tiffinfo (libtiff):                            See 4.1.      (line  938)
   4.270 -ufraw <1>:                                     See 6.        (line 1092)
   4.271 +pfshdrcalibrate (PFScalibration):              See 6.        (line 1250)
   4.272 +pfsin (PFSTools):                              See 6.        (line 1250)
   4.273 +pfsout (PFSTools):                             See 6.        (line 1250)
   4.274 +pfstmo_* (PFStmo):                             See 6.        (line 1250)
   4.275 +pfsview (PFSTools):                            See 6.        (line 1250)
   4.276 +PTmender (PanoTools):                          See 6.        (line 1223)
   4.277 +PTOptimizer (PanoTools):                       See 6.        (line 1223)
   4.278 +tifficc (LittleCMS):                           See 6.        (line 1273)
   4.279 +tiffinfo (libtiff) <1>:                        See 6.        (line 1265)
   4.280 +tiffinfo (libtiff):                            See 4.1.      (line 1050)
   4.281 +ufraw <1>:                                     See 6.        (line 1204)
   4.282  ufraw:                                         See 2.        (line  102)
   4.283 -ufraw-batch:                                   See 6.        (line 1092)
   4.284 +ufraw-batch:                                   See 6.        (line 1204)
   4.285  Option Index
   4.286  ************
   4.287  
   4.288 ---anneal:                                      See 3.3.      (line  521)
   4.289 ---coarse-mask:                                 See 3.3.      (line  567)
   4.290 ---compression:                                 See 3.1.      (line  197)
   4.291 ---depth:                                       See 3.2.      (line  395)
   4.292 ---dijkstra:                                    See 3.3.      (line  607)
   4.293 ---fine-mask:                                   See 3.3.      (line  620)
   4.294 ---gpu:                                         See 3.2.      (line  492)
   4.295 ---help:                                        See 3.1.      (line  233)
   4.296 ---load-masks:                                  See 3.3.      (line  627)
   4.297 ---mask-vectorize:                              See 3.3.      (line  633)
   4.298 ---no-optimize:                                 See 3.3.      (line  678)
   4.299 ---optimize:                                    See 3.3.      (line  686)
   4.300 ---optimizer-weights:                           See 3.3.      (line  709)
   4.301 ---output:                                      See 3.1.      (line  266)
   4.302 ---save-masks:                                  See 3.3.      (line  736)
   4.303 ---smooth-difference:                           See 3.3.      (line  764)
   4.304 ---verbose:                                     See 3.1.      (line  273)
   4.305 ---version:                                     See 3.1.      (line  308)
   4.306 ---visualize:                                   See 3.3.      (line  782)
   4.307 ---wrap:                                        See 3.1.      (line  315)
   4.308 --a:                                            See 3.1.      (line  189)
   4.309 --b <1>:                                        See 5.        (line 1012)
   4.310 --b:                                            See 3.2.      (line  373)
   4.311 --c:                                            See 3.2.      (line  384)
   4.312 --d:                                            See 3.2.      (line  395)
   4.313 --f:                                            See 3.2.      (line  472)
   4.314 --g:                                            See 3.2.      (line  480)
   4.315 --h:                                            See 3.1.      (line  233)
   4.316 --l:                                            See 3.1.      (line  236)
   4.317 --m <1>:                                        See 5.        (line 1012)
   4.318 --m:                                            See 3.2.      (line  504)
   4.319 --o:                                            See 3.1.      (line  266)
   4.320 --V:                                            See 3.1.      (line  308)
   4.321 --v:                                            See 3.1.      (line  273)
   4.322 --w:                                            See 3.1.      (line  315)
   4.323 --x:                                            See 3.1.      (line  352)
   4.324 +--anneal:                                      See 3.3.      (line  633)
   4.325 +--coarse-mask:                                 See 3.3.      (line  679)
   4.326 +--compression:                                 See 3.1.      (line  309)
   4.327 +--depth:                                       See 3.2.      (line  507)
   4.328 +--dijkstra:                                    See 3.3.      (line  719)
   4.329 +--fine-mask:                                   See 3.3.      (line  732)
   4.330 +--gpu:                                         See 3.2.      (line  604)
   4.331 +--help:                                        See 3.1.      (line  345)
   4.332 +--load-masks:                                  See 3.3.      (line  739)
   4.333 +--mask-vectorize:                              See 3.3.      (line  745)
   4.334 +--no-optimize:                                 See 3.3.      (line  790)
   4.335 +--optimize:                                    See 3.3.      (line  798)
   4.336 +--optimizer-weights:                           See 3.3.      (line  821)
   4.337 +--output:                                      See 3.1.      (line  378)
   4.338 +--save-masks:                                  See 3.3.      (line  848)
   4.339 +--smooth-difference:                           See 3.3.      (line  876)
   4.340 +--verbose:                                     See 3.1.      (line  385)
   4.341 +--version:                                     See 3.1.      (line  420)
   4.342 +--visualize:                                   See 3.3.      (line  894)
   4.343 +--wrap:                                        See 3.1.      (line  427)
   4.344 +-a:                                            See 3.1.      (line  301)
   4.345 +-b <1>:                                        See 5.        (line 1124)
   4.346 +-b:                                            See 3.2.      (line  485)
   4.347 +-c:                                            See 3.2.      (line  496)
   4.348 +-d:                                            See 3.2.      (line  507)
   4.349 +-f:                                            See 3.2.      (line  584)
   4.350 +-g:                                            See 3.2.      (line  592)
   4.351 +-h:                                            See 3.1.      (line  345)
   4.352 +-l:                                            See 3.1.      (line  348)
   4.353 +-m <1>:                                        See 5.        (line 1124)
   4.354 +-m:                                            See 3.2.      (line  616)
   4.355 +-o:                                            See 3.1.      (line  378)
   4.356 +-V:                                            See 3.1.      (line  420)
   4.357 +-v:                                            See 3.1.      (line  385)
   4.358 +-w:                                            See 3.1.      (line  427)
   4.359 +-x:                                            See 3.1.      (line  464)
   4.360  General Index
   4.361  *************
   4.362  
   4.363 -360o panoramas:                                See 3.1.      (line  315)
   4.364 -a.tif:                                         See 3.1.      (line  268)
   4.365 +360o panoramas:                                See 3.1.      (line  427)
   4.366 +a.tif:                                         See 3.1.      (line  380)
   4.367  affine transformation:                         See 2.        (line  139)
   4.368  alpha channel <1>:                             See 2.        (line  160)
   4.369  alpha channel:                                 See 1.        (line   49)
   4.370 -alpha channel, associated:                     See 3.2.      (line  480)
   4.371 -anneal parameters:                             See 3.3.      (line  521)
   4.372 +alpha channel, associated:                     See 3.2.      (line  592)
   4.373 +anneal parameters:                             See 3.3.      (line  633)
   4.374  authors, list of:                              See Appendix B.
   4.375 -                                                             (line 1316)
   4.376 -binary mask:                                   See 4.        (line  922)
   4.377 -bits per channel:                              See 3.2.      (line  395)
   4.378 -blur difference image:                         See 3.3.      (line  764)
   4.379 +                                                             (line 1428)
   4.380 +binary mask:                                   See 4.        (line 1034)
   4.381 +bits per channel:                              See 3.2.      (line  507)
   4.382 +blur difference image:                         See 3.3.      (line  876)
   4.383  bug reports:                                   See Appendix A.
   4.384 -                                                             (line 1169)
   4.385 +                                                             (line 1281)
   4.386  Burt-Adelson multiresolution spline:           See 1.        (line   37)
   4.387 -channel width:                                 See 3.2.      (line  395)
   4.388 +channel width:                                 See 3.2.      (line  507)
   4.389  channel, alpha:                                See 1.        (line   49)
   4.390 -CIECAM02:                                      See 3.2.      (line  384)
   4.391 -coarse mask:                                   See 3.3.      (line  567)
   4.392 -color appearance model:                        See 3.2.      (line  384)
   4.393 -color space, sRGB:                             See 3.2.      (line  386)
   4.394 -colors, visualization image:                   See 3.3.      (line  835)
   4.395 -compression:                                   See 3.1.      (line  197)
   4.396 -compression, deflate:                          See 3.1.      (line  212)
   4.397 -compression, JPEG:                             See 3.1.      (line  203)
   4.398 -compression, LZW:                              See 3.1.      (line  218)
   4.399 -compression, packbits:                         See 3.1.      (line  222)
   4.400 +CIECAM02:                                      See 3.2.      (line  496)
   4.401 +coarse mask:                                   See 3.3.      (line  679)
   4.402 +color appearance model:                        See 3.2.      (line  496)
   4.403 +color space, sRGB:                             See 3.2.      (line  498)
   4.404 +colors, visualization image:                   See 3.3.      (line  947)
   4.405 +compression:                                   See 3.1.      (line  309)
   4.406 +compression, deflate:                          See 3.1.      (line  324)
   4.407 +compression, JPEG:                             See 3.1.      (line  315)
   4.408 +compression, LZW:                              See 3.1.      (line  330)
   4.409 +compression, packbits:                         See 3.1.      (line  334)
   4.410  conversion, raw:                               See 2.        (line  126)
   4.411 -default output filename:                       See 3.1.      (line  268)
   4.412 -deflate compression:                           See 3.1.      (line  212)
   4.413 -DIJKSTRA radius:                               See 3.3.      (line  607)
   4.414 -double precision float, IEEE754:               See 3.2.      (line  447)
   4.415 +default output filename:                       See 3.1.      (line  380)
   4.416 +deflate compression:                           See 3.1.      (line  324)
   4.417 +DIJKSTRA radius:                               See 3.3.      (line  719)
   4.418 +double precision float, IEEE754:               See 3.2.      (line  559)
   4.419  feathering, detrimental effect of:             See 1.        (line   56)
   4.420 -fine mask:                                     See 3.3.      (line  620)
   4.421 +filenames, literal:                            See 3.        (line  183)
   4.422 +fine mask:                                     See 3.3.      (line  732)
   4.423 +format of response files:                      See 3.        (line  231)
   4.424  free documentation license (FDL):              See Appendix C.
   4.425 -                                                             (line 1355)
   4.426 +                                                             (line 1467)
   4.427  general index:
   4.428 -          See ``General Index''.                             (line 1834)
   4.429 +          See ``General Index''.                             (line 1946)
   4.430  GNU free documentation license:                See Appendix C.
   4.431 -                                                             (line 1355)
   4.432 -GPU (Graphics Processing Unit):                See 3.2.      (line  492)
   4.433 -graphics processing unit:                      See 3.2.      (line  492)
   4.434 -half precision float, OpenEXR:                 See 3.2.      (line  462)
   4.435 -helpful programs:                              See 6.        (line 1085)
   4.436 -Hugin:                                         See A.2.      (line 1259)
   4.437 -ICC profile:                                   See 3.2.      (line  386)
   4.438 -IEEE754 double precision float:                See 3.2.      (line  447)
   4.439 -IEEE754 single precision float:                See 3.2.      (line  438)
   4.440 -image cache:                                   See 5.        (line 1015)
   4.441 -image cache, block size:                       See 3.2.      (line  373)
   4.442 -image cache, cache size:                       See 3.2.      (line  504)
   4.443 -image cache, location:                         See 5.        (line 1026)
   4.444 -image colors, visualization:                   See 3.3.      (line  835)
   4.445 +                                                             (line 1467)
   4.446 +GPU (Graphics Processing Unit):                See 3.2.      (line  604)
   4.447 +grammar, response file:                        See 3.        (line  245)
   4.448 +graphics processing unit:                      See 3.2.      (line  604)
   4.449 +half precision float, OpenEXR:                 See 3.2.      (line  574)
   4.450 +helpful programs:                              See 6.        (line 1197)
   4.451 +Hugin:                                         See A.2.      (line 1371)
   4.452 +ICC profile:                                   See 3.2.      (line  498)
   4.453 +IEEE754 double precision float:                See 3.2.      (line  559)
   4.454 +IEEE754 single precision float:                See 3.2.      (line  550)
   4.455 +image cache:                                   See 5.        (line 1127)
   4.456 +image cache, block size:                       See 3.2.      (line  485)
   4.457 +image cache, cache size:                       See 3.2.      (line  616)
   4.458 +image cache, location:                         See 5.        (line 1138)
   4.459 +image colors, visualization:                   See 3.3.      (line  947)
   4.460  image, multi-layer:                            See 1.        (line   70)
   4.461 -image, visualization:                          See 3.3.      (line  800)
   4.462 +image, visualization:                          See 3.3.      (line  912)
   4.463  index, general:
   4.464 -          See ``General Index''.                             (line 1834)
   4.465 +          See ``General Index''.                             (line 1946)
   4.466  index, option:
   4.467 -          See ``Option Index''.                              (line 1795)
   4.468 +          See ``Option Index''.                              (line 1907)
   4.469  index, program:
   4.470 -          See ``Program Index''.                             (line 1753)
   4.471 -input mask:                                    See 4.1.      (line  934)
   4.472 +          See ``Program Index''.                             (line 1865)
   4.473 +input mask:                                    See 4.1.      (line 1046)
   4.474  invocation:                                    See 3.        (line  179)
   4.475 -JPEG compression:                              See 3.1.      (line  203)
   4.476 -KImageFuser:                                   See A.2.      (line 1259)
   4.477 +JPEG compression:                              See 3.1.      (line  315)
   4.478 +KImageFuser:                                   See A.2.      (line 1371)
   4.479  lens distortion, correction of:                See 2.        (line  139)
   4.480 -levels, pyramid:                               See 3.1.      (line  236)
   4.481 -LibJPEG:                                       See 6.        (line 1142)
   4.482 -LibPNG:                                        See 6.        (line 1145)
   4.483 -LibTiff:                                       See 6.        (line 1149)
   4.484 -load mask:                                     See 3.3.      (line  627)
   4.485 -loops in seam line:                            See 3.3.      (line  663)
   4.486 -LZW compression:                               See 3.1.      (line  218)
   4.487 -mask template character, %:                    See 3.3.      (line  839)
   4.488 -mask template character, B:                    See 3.3.      (line  888)
   4.489 -mask template character, b:                    See 3.3.      (line  882)
   4.490 -mask template character, D:                    See 3.3.      (line  879)
   4.491 -mask template character, d:                    See 3.3.      (line  873)
   4.492 -mask template character, E:                    See 3.3.      (line  907)
   4.493 -mask template character, e:                    See 3.3.      (line  901)
   4.494 -mask template character, F:                    See 3.3.      (line  897)
   4.495 -mask template character, f:                    See 3.3.      (line  891)
   4.496 -mask template character, i:                    See 3.3.      (line  842)
   4.497 -mask template character, n:                    See 3.3.      (line  857)
   4.498 -mask template character, P:                    See 3.3.      (line  870)
   4.499 -mask template character, p:                    See 3.3.      (line  862)
   4.500 -mask template characters, table of:            See 3.3.      (line  838)
   4.501 -mask, binary:                                  See 4.        (line  922)
   4.502 -mask, coarse:                                  See 3.3.      (line  567)
   4.503 -mask, fine:                                    See 3.3.      (line  620)
   4.504 -mask, generation:                              See 3.3.      (line  602)
   4.505 -mask, input files:                             See 4.1.      (line  934)
   4.506 -mask, load:                                    See 3.3.      (line  627)
   4.507 -mask, optimization visualization:              See 3.3.      (line  782)
   4.508 -mask, save:                                    See 3.3.      (line  736)
   4.509 -mask, vectorization distance:                  See 3.3.      (line  633)
   4.510 -mask, weight:                                  See 4.        (line  922)
   4.511 -masks, understanding:                          See 4.        (line  922)
   4.512 -memory, tuning usage of:                       See 5.        (line 1012)
   4.513 +levels, pyramid:                               See 3.1.      (line  348)
   4.514 +LibJPEG:                                       See 6.        (line 1254)
   4.515 +LibPNG:                                        See 6.        (line 1257)
   4.516 +LibTiff:                                       See 6.        (line 1261)
   4.517 +literal filenames:                             See 3.        (line  183)
   4.518 +load mask:                                     See 3.3.      (line  739)
   4.519 +loops in seam line:                            See 3.3.      (line  775)
   4.520 +LZW compression:                               See 3.1.      (line  330)
   4.521 +mask template character, %:                    See 3.3.      (line  951)
   4.522 +mask template character, B:                    See 3.3.      (line 1000)
   4.523 +mask template character, b:                    See 3.3.      (line  994)
   4.524 +mask template character, D:                    See 3.3.      (line  991)
   4.525 +mask template character, d:                    See 3.3.      (line  985)
   4.526 +mask template character, E:                    See 3.3.      (line 1019)
   4.527 +mask template character, e:                    See 3.3.      (line 1013)
   4.528 +mask template character, F:                    See 3.3.      (line 1009)
   4.529 +mask template character, f:                    See 3.3.      (line 1003)
   4.530 +mask template character, i:                    See 3.3.      (line  954)
   4.531 +mask template character, n:                    See 3.3.      (line  969)
   4.532 +mask template character, P:                    See 3.3.      (line  982)
   4.533 +mask template character, p:                    See 3.3.      (line  974)
   4.534 +mask template characters, table of:            See 3.3.      (line  950)
   4.535 +mask, binary:                                  See 4.        (line 1034)
   4.536 +mask, coarse:                                  See 3.3.      (line  679)
   4.537 +mask, fine:                                    See 3.3.      (line  732)
   4.538 +mask, generation:                              See 3.3.      (line  714)
   4.539 +mask, input files:                             See 4.1.      (line 1046)
   4.540 +mask, load:                                    See 3.3.      (line  739)
   4.541 +mask, optimization visualization:              See 3.3.      (line  894)
   4.542 +mask, save:                                    See 3.3.      (line  848)
   4.543 +mask, vectorization distance:                  See 3.3.      (line  745)
   4.544 +mask, weight:                                  See 4.        (line 1034)
   4.545 +masks, understanding:                          See 4.        (line 1034)
   4.546 +memory, tuning usage of:                       See 5.        (line 1124)
   4.547  multi-directory TIFF:                          See 1.        (line   70)
   4.548  multi-layer image:                             See 1.        (line   70)
   4.549 -nearest-feature transform (NFT):               See 3.3.      (line  602)
   4.550 +nearest-feature transform (NFT):               See 3.3.      (line  714)
   4.551  Octave:                                        See Appendix A.
   4.552 -                                                             (line 1169)
   4.553 -OpenEXR, data format:                          See 3.2.      (line  458)
   4.554 -OpenEXR, half precision float:                 See 3.2.      (line  462)
   4.555 -optimize seam:                                 See 3.3.      (line  678)
   4.556 -optimize strategy:                             See 3.3.      (line  691)
   4.557 -optimize, anneal parameters:                   See 3.3.      (line  521)
   4.558 -optimizer weights:                             See 3.3.      (line  709)
   4.559 -optimizer, simulated annealing:                See 3.3.      (line  521)
   4.560 +                                                             (line 1281)
   4.561 +OpenEXR, data format:                          See 3.2.      (line  570)
   4.562 +OpenEXR, half precision float:                 See 3.2.      (line  574)
   4.563 +optimize seam:                                 See 3.3.      (line  790)
   4.564 +optimize strategy:                             See 3.3.      (line  803)
   4.565 +optimize, anneal parameters:                   See 3.3.      (line  633)
   4.566 +optimizer weights:                             See 3.3.      (line  821)
   4.567 +optimizer, simulated annealing:                See 3.3.      (line  633)
   4.568  option index:
   4.569 -          See ``Option Index''.                              (line 1795)
   4.570 -options, common:                               See 3.1.      (line  186)
   4.571 -options, extended:                             See 3.2.      (line  369)
   4.572 -options, mask generation:                      See 3.3.      (line  518)
   4.573 -output file compression:                       See 3.1.      (line  197)
   4.574 -output filename, default:                      See 3.1.      (line  268)
   4.575 -output image, set size of:                     See 3.2.      (line  472)
   4.576 +          See ``Option Index''.                              (line 1907)
   4.577 +options, common:                               See 3.1.      (line  298)
   4.578 +options, extended:                             See 3.2.      (line  481)
   4.579 +options, mask generation:                      See 3.3.      (line  630)
   4.580 +output file compression:                       See 3.1.      (line  309)
   4.581 +output filename, default:                      See 3.1.      (line  380)
   4.582 +output image, set size of:                     See 3.2.      (line  584)
   4.583  overview:                                      See 1.        (line   37)
   4.584 -packbits compression:                          See 3.1.      (line  222)
   4.585 +packbits compression:                          See 3.1.      (line  334)
   4.586  parallax error:                                See 2.        (line  149)
   4.587  photometric alignment:                         See 2.        (line  141)
   4.588  problem reports:                               See Appendix A.
   4.589 -                                                             (line 1172)
   4.590 -profile, ICC:                                  See 3.2.      (line  386)
   4.591 +                                                             (line 1284)
   4.592 +profile, ICC:                                  See 3.2.      (line  498)
   4.593  program index:
   4.594 -          See ``Program Index''.                             (line 1753)
   4.595 -programs, helpful additional:                  See 6.        (line 1085)
   4.596 -pyramid levels:                                See 3.1.      (line  236)
   4.597 -radius, DIJKSTRA:                              See 3.3.      (line  607)
   4.598 +          See ``Program Index''.                             (line 1865)
   4.599 +programs, helpful additional:                  See 6.        (line 1197)
   4.600 +pyramid levels:                                See 3.1.      (line  348)
   4.601 +radius, DIJKSTRA:                              See 3.3.      (line  719)
   4.602  raw conversion:                                See 2.        (line  126)
   4.603 -save mask:                                     See 3.3.      (line  736)
   4.604 -seam line, loops:                              See 3.3.      (line  663)
   4.605 -seam optimization:                             See 3.3.      (line  678)
   4.606 -simulated annealing optimizer:                 See 3.3.      (line  521)
   4.607 -single precision float, IEEE754:               See 3.2.      (line  438)
   4.608 -smooth difference image:                       See 3.3.      (line  764)
   4.609 +response file, format:                         See 3.        (line  231)
   4.610 +response file, grammar:                        See 3.        (line  245)
   4.611 +response files:                                See 3.        (line  183)
   4.612 +save mask:                                     See 3.3.      (line  848)
   4.613 +seam line, loops:                              See 3.3.      (line  775)
   4.614 +seam optimization:                             See 3.3.      (line  790)
   4.615 +simulated annealing optimizer:                 See 3.3.      (line  633)
   4.616 +single precision float, IEEE754:               See 3.2.      (line  550)
   4.617 +smooth difference image:                       See 3.3.      (line  876)
   4.618  SourceForge <1>:                               See Appendix A.
   4.619 -                                                             (line 1175)
   4.620 +                                                             (line 1287)
   4.621  SourceForge:                                   See 1.        (line   76)
   4.622  SourceForge, tracker:                          See Appendix A.
   4.623 -                                                             (line 1175)
   4.624 -sRGB color space:                              See 3.2.      (line  386)
   4.625 +                                                             (line 1287)
   4.626 +sRGB color space:                              See 3.2.      (line  498)
   4.627  TIFF, multi-directory:                         See 1.        (line   70)
   4.628  tiffcopy:                                      See 1.        (line   70)
   4.629  tiffsplit:                                     See 1.        (line   70)
   4.630 -TMPDIR:                                        See 5.        (line 1026)
   4.631 +TMPDIR:                                        See 5.        (line 1138)
   4.632  tracker, SourceForge:                          See Appendix A.
   4.633 -                                                             (line 1175)
   4.634 +                                                             (line 1287)
   4.635  transformation, affine:                        See 2.        (line  139)
   4.636 -understanding masks:                           See 4.        (line  922)
   4.637 -visualization image:                           See 3.3.      (line  800)
   4.638 -visualization image colors:                    See 3.3.      (line  835)
   4.639 -visualization of mask optimization:            See 3.3.      (line  782)
   4.640 -weight mask:                                   See 4.        (line  922)
   4.641 -weights, optimizer:                            See 3.3.      (line  709)
   4.642 +understanding masks:                           See 4.        (line 1034)
   4.643 +visualization image:                           See 3.3.      (line  912)
   4.644 +visualization image colors:                    See 3.3.      (line  947)
   4.645 +visualization of mask optimization:            See 3.3.      (line  894)
   4.646 +weight mask:                                   See 4.        (line 1034)
   4.647 +weights, optimizer:                            See 3.3.      (line  821)
   4.648  workflow:                                      See 2.        (line   91)
   4.649  workflow with Enblend:                         See 2.        (line  102)
   4.650  workflow with Enfuse:                          See 2.        (line  102)
   4.651 -wrap around:                                   See 3.1.      (line  315)
   4.652 +wrap around:                                   See 3.1.      (line  427)
     5.1 --- a/doc/enblend.texi	Tue Nov 03 13:56:24 2009 +0100
     5.2 +++ b/doc/enblend.texi	Fri Nov 06 09:42:01 2009 +0100
     5.3 @@ -226,6 +226,8 @@
     5.4  Assemble the sequence of images @var{INPUT}@dots{} into a single
     5.5  @var{IMAGE}.
     5.6  
     5.7 +@include filespec.texi
     5.8 +
     5.9  @menu
    5.10  * Common Options::              General options
    5.11  * Extended Options::            Memory and @acronym{GPU} control
    5.12 @@ -416,7 +418,7 @@
    5.13  mask generation, pyramid, and blending
    5.14  
    5.15  @item 3
    5.16 -color conversions
    5.17 +reading of response files, color conversions
    5.18  
    5.19  @item 4
    5.20  image sizes, bounding boxes and intersection sizes
     6.1 --- a/doc/enfuse.info	Tue Nov 03 13:56:24 2009 +0100
     6.2 +++ b/doc/enfuse.info	Fri Nov 06 09:42:01 2009 +0100
     6.3 @@ -87,7 +87,7 @@
     6.4  Enfuse
     6.5  ******
     6.6  
     6.7 -This manual is for Enfuse (version 4.0-dd32463fe9de, 31 October 2009),
     6.8 +This manual is for Enfuse (version 4.0-dd32463fe9de, 5 November 2009),
     6.9  a program to merge different exposures of the same scene to produce an
    6.10  image that looks much like a tonemapped image.
    6.11  
    6.12 @@ -281,6 +281,118 @@
    6.13  
    6.14  Fuse the sequence of images INPUT... into a single IMAGE.
    6.15  
    6.16 +   Input images are either specified literally or via so-called response
    6.17 +files.  A response file contains filenames of images or other response
    6.18 +filenames.  Introduce response file names with an at-character (`@').
    6.19 +
    6.20 +   Enblend and Enfuse process the list INPUT... from left to right,
    6.21 +expanding response files depth-first.  The following examples only show
    6.22 +Enblend, but Enfuse works exactly the same.
    6.23 +
    6.24 +Solely literal filenames.
    6.25 +     Example:
    6.26 +          enblend image-1.tif image-2.tif image-3.tif
    6.27 +
    6.28 +     The ultimate order in which the images are processed is:
    6.29 +     `image-1.tif', `image-2.tif', `image-3.tif'.
    6.30 +
    6.31 +Single response file.
    6.32 +     Example:
    6.33 +          enblend @list
    6.34 +     where file `list' contains
    6.35 +          img1.exr
    6.36 +          img2.exr
    6.37 +          img3.exr
    6.38 +          img4.exr
    6.39 +
    6.40 +     Ultimate order: `img1.exr', `img2.exr', `img3.exr', `img4.exr'.
    6.41 +
    6.42 +Mixed literal names and response files.
    6.43 +     Example:
    6.44 +          enblend @master.list image-09.png image-10.png
    6.45 +     where file `master.list' comprises of
    6.46 +          image-01.png
    6.47 +          @first.list
    6.48 +          image-04.png
    6.49 +          @second.list
    6.50 +          image-08.png
    6.51 +     `first.list' is
    6.52 +          image-02.png
    6.53 +          image-03.png
    6.54 +     and `second.list' contains
    6.55 +          image-05.png
    6.56 +          image-06.png
    6.57 +          image-07.png
    6.58 +
    6.59 +     Ultimate order: `image-01.png', `image-02.png', `image-03.png',
    6.60 +     `image-04.png', `image-05.png', `image-06.png', `image-07.png',
    6.61 +     `image-08.png', `image-09.png', `image-10.png',
    6.62 +
    6.63 +
    6.64 +*Response File Format* Response files contain one filename per line.
    6.65 +Blank lines or lines beginning with a sharp sign (`#') are ignored.
    6.66 +Filenames that begin with an at-character (`@') denote other response
    6.67 +files.  *note Table:response-file-format:: states a formal grammar of
    6.68 +response files in EBNF (http://en.wikipedia.org/wiki/Ebnf).
    6.69 +
    6.70 +RESPONSE-FILE   ::=   LINE*
    6.71 +LINE            ::=   (COMMENT | FILE-SPEC) [`\r'] `\n'
    6.72 +COMMENT         ::=   SPACE* `#' TEXT
    6.73 +FILE-SPEC       ::=   SPACE* `@' FILENAME SPACE*
    6.74 +SPACE           ::=   ` ' | `\t'
    6.75 +
    6.76 +where TEXT is an arbitrary string and FILENAME is any filename.
    6.77 +
    6.78 +Table 3.1: EBNF definition of the grammar of response files.
    6.79 +
    6.80 +   In a response file all relative filenames are used relative the the
    6.81 +response file itself, not relative to the current-working directory of
    6.82 +the application.
    6.83 +
    6.84 +The above grammar might unpleasantly surprise the user in the some ways:
    6.85 +
    6.86 +Literal filenames
    6.87 +     Inside a response file all filenames are treated as literals.  No
    6.88 +     filename globing or expansion is performed.  This is, the line
    6.89 +          img_*.tif
    6.90 +     stands for exactly one file called `img_*.tif'.
    6.91 +
    6.92 +Whitespace trimmed at both line ends
    6.93 +     For convenience whitespace at the beginning and at the end of each
    6.94 +     line is ignored.  However, this implies that response files cannot
    6.95 +     represent filenames that start or end with whitespace, as there is
    6.96 +     no quoting syntax.  Filenames with embedded whatespace cause no
    6.97 +     problems, though.
    6.98 +
    6.99 +Only whole-line comments
   6.100 +     Comments in response files always occupy a complete line.  There
   6.101 +     are no line-ending comments.  Thus in
   6.102 +          # exposure series
   6.103 +          img-0.33ev.tif # "middle" EV
   6.104 +          img-1.33ev.tif
   6.105 +          img+0.67ev.tif
   6.106 +     only the first line contains a comment, whereas the second lines
   6.107 +     includes none.  Rather it refers to
   6.108 +     file `img-0.33ev.tif # "middle" EV'.
   6.109 +
   6.110 +Image filenames cannot start with `@'
   6.111 +     An at-sign always introduces a response file, even if the extension
   6.112 +     would hinto towards an image.
   6.113 +
   6.114 +Here is an example of a valid response file.
   6.115 +     # 4\pi panorama!
   6.116 +
   6.117 +     # These pictures were taken with the panorama head.
   6.118 +     @round-shots.list
   6.119 +
   6.120 +     # Freehand sky shot.
   6.121 +     zenith.tif
   6.122 +
   6.123 +     # "Legs, will you go away?" images.
   6.124 +     nadir-2.tif
   6.125 +     nadir-5.tif
   6.126 +     nadir.tif
   6.127 +
   6.128  3.1 Common Options
   6.129  ==================
   6.130  
   6.131 @@ -383,7 +495,7 @@
   6.132            mask generation, pyramid, and blending
   6.133  
   6.134      3
   6.135 -          color conversions
   6.136 +          reading of response files, color conversions
   6.137  
   6.138      4
   6.139            image sizes, bounding boxes and intersection sizes
   6.140 @@ -934,7 +1046,7 @@
   6.141  `%E'
   6.142       Is replaced with the extension of the output file.
   6.143  
   6.144 -Table 3.1: Special characters to control the generation of mask
   6.145 +Table 3.2: Special characters to control the generation of mask
   6.146  filenames.
   6.147  
   6.148  3.5 Option Delimiters
   6.149 @@ -2807,7 +2919,8 @@
   6.150  **************
   6.151  
   6.152  Table 1.1: Weighting criteria                  See 1.
   6.153 -Table 3.1: Mask template characters            See 3.4.
   6.154 +Table 3.1: Response-file grammar               See 3.
   6.155 +Table 3.2: Mask template characters            See 3.4.
   6.156  Table 6.1: Suggested cache-size settings       See 6.
   6.157  
   6.158  List of Figures
   6.159 @@ -2826,330 +2939,337 @@
   6.160  Program Index
   6.161  *************
   6.162  
   6.163 -ale:                                           See 8.        (line 2155)
   6.164 -align_image_stack (Hugin):                     See 8.        (line 2162)
   6.165 -cinepaint <1>:                                 See 8.        (line 2174)
   6.166 -cinepaint:                                     See 3.2.      (line  574)
   6.167 -convert (ImageMagick):                         See 8.        (line 2185)
   6.168 -dcraw <1>:                                     See 8.        (line 2145)
   6.169 +ale:                                           See 8.        (line 2267)
   6.170 +align_image_stack (Hugin):                     See 8.        (line 2274)
   6.171 +cinepaint <1>:                                 See 8.        (line 2286)
   6.172 +cinepaint:                                     See 3.2.      (line  686)
   6.173 +convert (ImageMagick):                         See 8.        (line 2297)
   6.174 +dcraw <1>:                                     See 8.        (line 2257)
   6.175  dcraw:                                         See 2.        (line  203)
   6.176 -display (ImageMagick):                         See 8.        (line 2185)
   6.177 -exiftool:                                      See 8.        (line 2213)
   6.178 -exrdisplay (OpenEXR):                          See 8.        (line 2191)
   6.179 -fulla (Hugin):                                 See 8.        (line 2162)
   6.180 -gimp <1>:                                      See 8.        (line 2181)
   6.181 -gimp <2>:                                      See 3.2.      (line  574)
   6.182 +display (ImageMagick):                         See 8.        (line 2297)
   6.183 +exiftool:                                      See 8.        (line 2325)
   6.184 +exrdisplay (OpenEXR):                          See 8.        (line 2303)
   6.185 +fulla (Hugin):                                 See 8.        (line 2274)
   6.186 +gimp <1>:                                      See 8.        (line 2293)
   6.187 +gimp <2>:                                      See 3.2.      (line  686)
   6.188  gimp:                                          See 2.        (line  203)
   6.189 -gm (GraphicsMagick):                           See 8.        (line 2185)
   6.190 -hugin <1>:                                     See 8.        (line 2159)
   6.191 -hugin <2>:                                     See 7.1.      (line 1599)
   6.192 -hugin <3>:                                     See 3.2.      (line  565)
   6.193 +gm (GraphicsMagick):                           See 8.        (line 2297)
   6.194 +hugin <1>:                                     See 8.        (line 2271)
   6.195 +hugin <2>:                                     See 7.1.      (line 1711)
   6.196 +hugin <3>:                                     See 3.2.      (line  677)
   6.197  hugin:                                         See 2.        (line  203)
   6.198 -identify (ImageMagick) <1>:                    See 8.        (line 2185)
   6.199 -identify (ImageMagick):                        See 5.1.      (line 1438)
   6.200 -montage (ImageMagick):                         See 8.        (line 2185)
   6.201 -nona (Hugin) <1>:                              See 8.        (line 2162)
   6.202 -nona (Hugin):                                  See 3.2.      (line  565)
   6.203 +identify (ImageMagick) <1>:                    See 8.        (line 2297)
   6.204 +identify (ImageMagick):                        See 5.1.      (line 1550)
   6.205 +montage (ImageMagick):                         See 8.        (line 2297)
   6.206 +nona (Hugin) <1>:                              See 8.        (line 2274)
   6.207 +nona (Hugin):                                  See 3.2.      (line  677)
   6.208  PanoTools:                                     See 2.        (line  203)
   6.209 -pfshdrcalibrate (PFScalibration):              See 8.        (line 2194)
   6.210 -pfsin (PFSTools):                              See 8.        (line 2194)
   6.211 -pfsout (PFSTools):                             See 8.        (line 2194)
   6.212 -pfstmo_* (PFStmo):                             See 8.        (line 2194)
   6.213 -pfsview (PFSTools):                            See 8.        (line 2194)
   6.214 -PTmender (PanoTools):                          See 8.        (line 2167)
   6.215 -PTOptimizer (PanoTools):                       See 8.        (line 2167)
   6.216 -tifficc (LittleCMS):                           See 8.        (line 2217)
   6.217 -tiffinfo (libtiff) <1>:                        See 8.        (line 2209)
   6.218 -tiffinfo (libtiff):                            See 5.1.      (line 1438)
   6.219 -ufraw <1>:                                     See 8.        (line 2148)
   6.220 +pfshdrcalibrate (PFScalibration):              See 8.        (line 2306)
   6.221 +pfsin (PFSTools):                              See 8.        (line 2306)
   6.222 +pfsout (PFSTools):                             See 8.        (line 2306)
   6.223 +pfstmo_* (PFStmo):                             See 8.        (line 2306)
   6.224 +pfsview (PFSTools):                            See 8.        (line 2306)
   6.225 +PTmender (PanoTools):                          See 8.        (line 2279)
   6.226 +PTOptimizer (PanoTools):                       See 8.        (line 2279)
   6.227 +tifficc (LittleCMS):                           See 8.        (line 2329)
   6.228 +tiffinfo (libtiff) <1>:                        See 8.        (line 2321)
   6.229 +tiffinfo (libtiff):                            See 5.1.      (line 1550)
   6.230 +ufraw <1>:                                     See 8.        (line 2260)
   6.231  ufraw:                                         See 2.        (line  203)
   6.232 -ufraw-batch:                                   See 8.        (line 2148)
   6.233 +ufraw-batch:                                   See 8.        (line 2260)
   6.234  Option Index
   6.235  ************
   6.236  
   6.237 ---compression:                                 See 3.1.      (line  290)
   6.238 ---contrast-edge-scale:                         See 3.4.      (line  679)
   6.239 ---contrast-min-curvature:                      See 3.4.      (line  816)
   6.240 ---contrast-weight:                             See 3.3.      (line  600)
   6.241 ---contrast-window-size:                        See 3.4.      (line  659)
   6.242 ---ContrastWindowSize (deprecated):             See 3.4.      (line  659)
   6.243 ---depth:                                       See 3.2.      (line  485)
   6.244 ---EdgeScale (deprecated):                      See 3.4.      (line  679)
   6.245 ---entropy-cutoff:                              See 3.4.      (line  700)
   6.246 ---entropy-weight:                              See 3.3.      (line  607)
   6.247 ---entropy-window-size:                         See 3.4.      (line  729)
   6.248 ---EntropyCutoff (deprecated):                  See 3.4.      (line  700)
   6.249 ---EntropyWindowSize (deprecated):              See 3.4.      (line  729)
   6.250 ---exposure-mu:                                 See 3.3.      (line  623)
   6.251 ---exposure-sigma:                              See 3.3.      (line  633)
   6.252 ---exposure-weight:                             See 3.3.      (line  615)
   6.253 ---gray-projector:                              See 3.4.      (line  745)
   6.254 ---GrayProjector (deprecated):                  See 3.4.      (line  745)
   6.255 ---hard-mask <1>:                               See 7.6.6.    (line 2123)
   6.256 ---hard-mask <2>:                               See 4.1.2.    (line 1043)
   6.257 ---hard-mask:                                   See 3.4.      (line  802)
   6.258 ---HardMask (deprecated):                       See 3.4.      (line  802)
   6.259 ---help:                                        See 3.1.      (line  327)
   6.260 ---MinCurvature (deprecated):                   See 3.4.      (line  816)
   6.261 ---output:                                      See 3.1.      (line  360)
   6.262 ---saturation-weight:                           See 3.3.      (line  644)
   6.263 ---save-masks:                                  See 3.4.      (line  834)
   6.264 ---SaveMasks (deprecated):                      See 3.4.      (line  834)
   6.265 ---soft-mask:                                   See 3.4.      (line  862)
   6.266 ---SoftMask (deprecated):                       See 3.4.      (line  862)
   6.267 ---verbose:                                     See 3.1.      (line  367)
   6.268 ---version:                                     See 3.1.      (line  402)
   6.269 ---wContrast (deprecated):                      See 3.3.      (line  600)
   6.270 ---wEntropy (deprecated):                       See 3.3.      (line  607)
   6.271 ---wExposureMu (deprecated):                    See 3.3.      (line  615)
   6.272 ---wExposureSigma (deprecated):                 See 3.3.      (line  633)
   6.273 ---wrap:                                        See 3.1.      (line  409)
   6.274 ---wSaturation (deprecated):                    See 3.3.      (line  644)
   6.275 --b <1>:                                        See 6.        (line 1512)
   6.276 --b:                                            See 3.2.      (line  463)
   6.277 --c:                                            See 3.2.      (line  474)
   6.278 --d:                                            See 3.2.      (line  485)
   6.279 --f:                                            See 3.2.      (line  562)
   6.280 --g:                                            See 3.2.      (line  570)
   6.281 --h:                                            See 3.1.      (line  327)
   6.282 --l:                                            See 3.1.      (line  330)
   6.283 --m <1>:                                        See 6.        (line 1512)
   6.284 --m:                                            See 3.2.      (line  582)
   6.285 --o:                                            See 3.1.      (line  360)
   6.286 --V:                                            See 3.1.      (line  402)
   6.287 --v:                                            See 3.1.      (line  367)
   6.288 --w:                                            See 3.1.      (line  409)
   6.289 +--compression:                                 See 3.1.      (line  402)
   6.290 +--contrast-edge-scale:                         See 3.4.      (line  791)
   6.291 +--contrast-min-curvature:                      See 3.4.      (line  928)
   6.292 +--contrast-weight:                             See 3.3.      (line  712)
   6.293 +--contrast-window-size:                        See 3.4.      (line  771)
   6.294 +--ContrastWindowSize (deprecated):             See 3.4.      (line  771)
   6.295 +--depth:                                       See 3.2.      (line  597)
   6.296 +--EdgeScale (deprecated):                      See 3.4.      (line  791)
   6.297 +--entropy-cutoff:                              See 3.4.      (line  812)
   6.298 +--entropy-weight:                              See 3.3.      (line  719)
   6.299 +--entropy-window-size:                         See 3.4.      (line  841)
   6.300 +--EntropyCutoff (deprecated):                  See 3.4.      (line  812)
   6.301 +--EntropyWindowSize (deprecated):              See 3.4.      (line  841)
   6.302 +--exposure-mu:                                 See 3.3.      (line  735)
   6.303 +--exposure-sigma:                              See 3.3.      (line  745)
   6.304 +--exposure-weight:                             See 3.3.      (line  727)
   6.305 +--gray-projector:                              See 3.4.      (line  857)
   6.306 +--GrayProjector (deprecated):                  See 3.4.      (line  857)
   6.307 +--hard-mask <1>:                               See 7.6.6.    (line 2235)
   6.308 +--hard-mask <2>:                               See 4.1.2.    (line 1155)
   6.309 +--hard-mask:                                   See 3.4.      (line  914)
   6.310 +--HardMask (deprecated):                       See 3.4.      (line  914)
   6.311 +--help:                                        See 3.1.      (line  439)
   6.312 +--MinCurvature (deprecated):                   See 3.4.      (line  928)
   6.313 +--output:                                      See 3.1.      (line  472)
   6.314 +--saturation-weight:                           See 3.3.      (line  756)
   6.315 +--save-masks:                                  See 3.4.      (line  946)
   6.316 +--SaveMasks (deprecated):                      See 3.4.      (line  946)
   6.317 +--soft-mask:                                   See 3.4.      (line  974)
   6.318 +--SoftMask (deprecated):                       See 3.4.      (line  974)
   6.319 +--verbose:                                     See 3.1.      (line  479)
   6.320 +--version:                                     See 3.1.      (line  514)
   6.321 +--wContrast (deprecated):                      See 3.3.      (line  712)
   6.322 +--wEntropy (deprecated):                       See 3.3.      (line  719)
   6.323 +--wExposureMu (deprecated):                    See 3.3.      (line  727)
   6.324 +--wExposureSigma (deprecated):                 See 3.3.      (line  745)
   6.325 +--wrap:                                        See 3.1.      (line  521)
   6.326 +--wSaturation (deprecated):                    See 3.3.      (line  756)
   6.327 +-b <1>:                                        See 6.        (line 1624)
   6.328 +-b:                                            See 3.2.      (line  575)
   6.329 +-c:                                            See 3.2.      (line  586)
   6.330 +-d:                                            See 3.2.      (line  597)
   6.331 +-f:                                            See 3.2.      (line  674)
   6.332 +-g:                                            See 3.2.      (line  682)
   6.333 +-h:                                            See 3.1.      (line  439)
   6.334 +-l:                                            See 3.1.      (line  442)
   6.335 +-m <1>:                                        See 6.        (line 1624)
   6.336 +-m:                                            See 3.2.      (line  694)
   6.337 +-o:                                            See 3.1.      (line  472)
   6.338 +-V:                                            See 3.1.      (line  514)
   6.339 +-v:                                            See 3.1.      (line  479)
   6.340 +-w:                                            See 3.1.      (line  521)
   6.341  General Index
   6.342  *************
   6.343  
   6.344 -360o panoramas:                                See 3.1.      (line  409)
   6.345 -a.tif:                                         See 3.1.      (line  362)
   6.346 -advanced focus stacking:                       See 7.6.5.    (line 1934)
   6.347 +360o panoramas:                                See 3.1.      (line  521)
   6.348 +a.tif:                                         See 3.1.      (line  474)
   6.349 +advanced focus stacking:                       See 7.6.5.    (line 2046)
   6.350  advanced focus stacking, recognizing faint edges:See 7.6.5.4.
   6.351 -                                                             (line 2028)
   6.352 -advanced focus stacking, suppressing noise:    See 7.6.5.4.  (line 2028)
   6.353 +                                                             (line 2140)
   6.354 +advanced focus stacking, suppressing noise:    See 7.6.5.4.  (line 2140)
   6.355  affine transformation:                         See 2.        (line  240)
   6.356  alpha channel <1>:                             See 2.        (line  261)
   6.357  alpha channel:                                 See 1.        (line  155)
   6.358 -alpha channel, associated:                     See 3.2.      (line  570)
   6.359 -aperture, sweet spot:                          See 7.6.1.    (line 1843)
   6.360 -applications of enfuse:                        See 7.        (line 1585)
   6.361 +alpha channel, associated:                     See 3.2.      (line  682)
   6.362 +aperture, sweet spot:                          See 7.6.1.    (line 1955)
   6.363 +applications of enfuse:                        See 7.        (line 1697)
   6.364  authors, list of:                              See Appendix B.
   6.365 -                                                             (line 2372)
   6.366 -average, disabling:                            See 4.1.2.    (line 1043)
   6.367 -average, weighted:                             See 4.1.1.    (line 1031)
   6.368 -basic focus stacking:                          See 7.6.4.    (line 1906)
   6.369 -binary mask:                                   See 5.        (line 1422)
   6.370 -bits per channel:                              See 3.2.      (line  485)
   6.371 -blending exposures:                            See 7.3.2.    (line 1761)
   6.372 +                                                             (line 2484)
   6.373 +average, disabling:                            See 4.1.2.    (line 1155)
   6.374 +average, weighted:                             See 4.1.1.    (line 1143)
   6.375 +basic focus stacking:                          See 7.6.4.    (line 2018)
   6.376 +binary mask:                                   See 5.        (line 1534)
   6.377 +bits per channel:                              See 3.2.      (line  597)
   6.378 +blending exposures:                            See 7.3.2.    (line 1873)
   6.379  bug reports:                                   See Appendix A.
   6.380 -                                                             (line 2225)
   6.381 +                                                             (line 2337)
   6.382  Burt-Adelson multiresolution spline:           See 1.        (line  112)
   6.383 -channel width:                                 See 3.2.      (line  485)
   6.384 +channel width:                                 See 3.2.      (line  597)
   6.385  channel, alpha:                                See 1.        (line  155)
   6.386 -CIECAM02:                                      See 3.2.      (line  474)
   6.387 -circle-of-confusion:                           See 7.6.1.    (line 1831)
   6.388 -color appearance model:                        See 3.2.      (line  474)
   6.389 -color space, sRGB:                             See 3.2.      (line  476)
   6.390 -compression:                                   See 3.1.      (line  290)
   6.391 -compression, deflate:                          See 3.1.      (line  305)
   6.392 -compression, JPEG:                             See 3.1.      (line  296)
   6.393 -compression, LZW:                              See 3.1.      (line  311)
   6.394 -compression, packbits:                         See 3.1.      (line  315)
   6.395 -contrast enhancement, local:                   See 7.6.5.3.  (line 2007)
   6.396 -contrast weighting using a blend of methods:   See 4.4.3.    (line 1307)
   6.397 -contrast weighting using laplacian-of-gaussian:See 4.4.2.    (line 1245)
   6.398 -contrast weighting using standard deviation:   See 4.4.1.    (line 1176)
   6.399 -conversion, L*a*b*:                            See 3.4.      (line  776)
   6.400 +CIECAM02:                                      See 3.2.      (line  586)
   6.401 +circle-of-confusion:                           See 7.6.1.    (line 1943)
   6.402 +color appearance model:                        See 3.2.      (line  586)
   6.403 +color space, sRGB:                             See 3.2.      (line  588)
   6.404 +compression:                                   See 3.1.      (line  402)
   6.405 +compression, deflate:                          See 3.1.      (line  417)
   6.406 +compression, JPEG:                             See 3.1.      (line  408)
   6.407 +compression, LZW:                              See 3.1.      (line  423)
   6.408 +compression, packbits:                         See 3.1.      (line  427)
   6.409 +contrast enhancement, local:                   See 7.6.5.3.  (line 2119)
   6.410 +contrast weighting using a blend of methods:   See 4.4.3.    (line 1419)
   6.411 +contrast weighting using laplacian-of-gaussian:See 4.4.2.    (line 1357)
   6.412 +contrast weighting using standard deviation:   See 4.4.1.    (line 1288)
   6.413 +conversion, L*a*b*:                            See 3.4.      (line  888)
   6.414  conversion, raw:                               See 2.        (line  227)
   6.415 -dark frame:                                    See 7.6.6.    (line 2119)
   6.416 -decision tree, focus stacking:                 See 7.6.5.5.  (line 2084)
   6.417 -default output filename:                       See 3.1.      (line  362)
   6.418 -deflate compression:                           See 3.1.      (line  305)
   6.419 -delimiters, option:                            See 3.5.      (line  943)
   6.420 -depth-of-field:                                See 7.6.1.    (line 1834)
   6.421 -depth-of-focus increase:                       See 7.6.      (line 1815)
   6.422 -digital blending:                              See 7.3.2.    (line 1761)
   6.423 -disabling average:                             See 4.1.2.    (line 1043)
   6.424 -double precision float, IEEE754:               See 3.2.      (line  537)
   6.425 -dynamic range increase <1>:                    See 7.4.      (line 1799)
   6.426 -dynamic range increase:                        See 7.3.      (line 1696)
   6.427 -edge detection, laplacian:                     See 7.6.5.2.  (line 1987)
   6.428 -entropy:                                       See 4.5.      (line 1368)
   6.429 -entropy, definition:                           See 4.5.      (line 1365)
   6.430 -estimators:                                    See 4.4.1.2.  (line 1226)
   6.431 -expectation value:                             See 4.4.1.1.  (line 1210)
   6.432 -expert focus stacking tips:                    See 7.6.6.    (line 2107)
   6.433 -exposure series:                               See 7.3.      (line 1696)
   6.434 -exposure series, common misconceptions:        See 7.3.2.    (line 1758)
   6.435 -exposure series, tips for beginners:           See 7.3.1.    (line 1734)
   6.436 -filename template:                             See 3.4.      (line  839)
   6.437 -flash exposure series:                         See 7.4.      (line 1799)
   6.438 -focus stacking decision tree:                  See 7.6.5.5.  (line 2084)
   6.439 -focus stacking, advanced:                      See 7.6.5.    (line 1934)
   6.440 -focus stacking, basic:                         See 7.6.4.    (line 1906)
   6.441 -focus stacks:                                  See 7.6.      (line 1815)
   6.442 -focus stacks, fusing:                          See 7.6.3.    (line 1868)
   6.443 -focus stacks, preparation:                     See 7.6.2.    (line 1854)
   6.444 -focus stacks, why create them:                 See 7.6.1.    (line 1825)
   6.445 +dark frame:                                    See 7.6.6.    (line 2231)
   6.446 +decision tree, focus stacking:                 See 7.6.5.5.  (line 2196)
   6.447 +default output filename:                       See 3.1.      (line  474)
   6.448 +deflate compression:                           See 3.1.      (line  417)
   6.449 +delimiters, option:                            See 3.5.      (line 1055)
   6.450 +depth-of-field:                                See 7.6.1.    (line 1946)
   6.451 +depth-of-focus increase:                       See 7.6.      (line 1927)
   6.452 +digital blending:                              See 7.3.2.    (line 1873)
   6.453 +disabling average:                             See 4.1.2.    (line 1155)
   6.454 +double precision float, IEEE754:               See 3.2.      (line  649)
   6.455 +dynamic range increase <1>:                    See 7.4.      (line 1911)
   6.456 +dynamic range increase:                        See 7.3.      (line 1808)
   6.457 +edge detection, laplacian:                     See 7.6.5.2.  (line 2099)
   6.458 +entropy:                                       See 4.5.      (line 1480)
   6.459 +entropy, definition:                           See 4.5.      (line 1477)
   6.460 +estimators:                                    See 4.4.1.2.  (line 1338)
   6.461 +expectation value:                             See 4.4.1.1.  (line 1322)
   6.462 +expert focus stacking tips:                    See 7.6.6.    (line 2219)
   6.463 +exposure series:                               See 7.3.      (line 1808)
   6.464 +exposure series, common misconceptions:        See 7.3.2.    (line 1870)
   6.465 +exposure series, tips for beginners:           See 7.3.1.    (line 1846)
   6.466 +filename template:                             See 3.4.      (line  951)
   6.467 +filenames, literal:                            See 3.        (line  284)
   6.468 +flash exposure series:                         See 7.4.      (line 1911)
   6.469 +focus stacking decision tree:                  See 7.6.5.5.  (line 2196)
   6.470 +focus stacking, advanced:                      See 7.6.5.    (line 2046)
   6.471 +focus stacking, basic:                         See 7.6.4.    (line 2018)
   6.472 +focus stacks:                                  See 7.6.      (line 1927)
   6.473 +focus stacks, fusing:                          See 7.6.3.    (line 1980)
   6.474 +focus stacks, preparation:                     See 7.6.2.    (line 1966)
   6.475 +focus stacks, why create them:                 See 7.6.1.    (line 1937)
   6.476 +format of response files:                      See 3.        (line  332)
   6.477  free documentation license (FDL):              See Appendix C.
   6.478 -                                                             (line 2411)
   6.479 -fusing, local-contrast-based:                  See 7.6.3.    (line 1868)
   6.480 +                                                             (line 2523)
   6.481 +fusing, local-contrast-based:                  See 7.6.3.    (line 1980)
   6.482  general index:
   6.483 -          See ``General Index''.                             (line 2925)
   6.484 +          See ``General Index''.                             (line 3038)
   6.485  GNU free documentation license:                See Appendix C.
   6.486 -                                                             (line 2411)
   6.487 -gray projector:                                See 3.4.      (line  745)
   6.488 -gray projector, average:                       See 3.4.      (line  756)
   6.489 -gray projector, channel-mixer:                 See 3.4.      (line  762)
   6.490 -gray projector, l-star:                        See 3.4.      (line  776)
   6.491 -gray projector, lightness:                     See 3.4.      (line  786)
   6.492 -gray projector, luminance:                     See 3.4.      (line  791)
   6.493 -gray projector, value:                         See 3.4.      (line  797)
   6.494 -half precision float, OpenEXR:                 See 3.2.      (line  552)
   6.495 -helpful programs:                              See 8.        (line 2141)
   6.496 -hot pixels:                                    See 7.6.6.    (line 2119)
   6.497 -Hugin:                                         See A.2.      (line 2315)
   6.498 -ICC profile:                                   See 3.2.      (line  476)
   6.499 -IEEE754 double precision float:                See 3.2.      (line  537)
   6.500 -IEEE754 single precision float:                See 3.2.      (line  528)
   6.501 -image cache:                                   See 6.        (line 1515)
   6.502 -image cache, block size:                       See 3.2.      (line  463)
   6.503 -image cache, cache size:                       See 3.2.      (line  582)
   6.504 -image cache, location:                         See 6.        (line 1526)
   6.505 +                                                             (line 2523)
   6.506 +grammar, response file:                        See 3.        (line  346)
   6.507 +gray projector:                                See 3.4.      (line  857)
   6.508 +gray projector, average:                       See 3.4.      (line  868)
   6.509 +gray projector, channel-mixer:                 See 3.4.      (line  874)
   6.510 +gray projector, l-star:                        See 3.4.      (line  888)
   6.511 +gray projector, lightness:                     See 3.4.      (line  898)
   6.512 +gray projector, luminance:                     See 3.4.      (line  903)
   6.513 +gray projector, value:                         See 3.4.      (line  909)
   6.514 +half precision float, OpenEXR:                 See 3.2.      (line  664)
   6.515 +helpful programs:                              See 8.        (line 2253)
   6.516 +hot pixels:                                    See 7.6.6.    (line 2231)
   6.517 +Hugin:                                         See A.2.      (line 2427)
   6.518 +ICC profile:                                   See 3.2.      (line  588)
   6.519 +IEEE754 double precision float:                See 3.2.      (line  649)
   6.520 +IEEE754 single precision float:                See 3.2.      (line  640)
   6.521 +image cache:                                   See 6.        (line 1627)
   6.522 +image cache, block size:                       See 3.2.      (line  575)
   6.523 +image cache, cache size:                       See 3.2.      (line  694)
   6.524 +image cache, location:                         See 6.        (line 1638)
   6.525  image, multi-layer:                            See 1.        (line  163)
   6.526 -images, fusable:                               See 7.1.      (line 1592)
   6.527 +images, fusable:                               See 7.1.      (line 1704)
   6.528  index, general:
   6.529 -          See ``General Index''.                             (line 2925)
   6.530 +          See ``General Index''.                             (line 3038)
   6.531  index, option:
   6.532 -          See ``Option Index''.                              (line 2870)
   6.533 +          See ``Option Index''.                              (line 2983)
   6.534  index, program:
   6.535 -          See ``Program Index''.                             (line 2829)
   6.536 -input mask:                                    See 5.1.      (line 1434)
   6.537 +          See ``Program Index''.                             (line 2942)
   6.538 +input mask:                                    See 5.1.      (line 1546)
   6.539  invocation:                                    See 3.        (line  280)
   6.540 -JPEG compression:                              See 3.1.      (line  296)
   6.541 -KImageFuser:                                   See A.2.      (line 2315)
   6.542 -L*a*b* conversion:                             See 3.4.      (line  776)
   6.543 -laplacian edge detection:                      See 7.6.5.2.  (line 1987)
   6.544 -Laplacian of Gaussian (LoG):                   See 4.4.2.    (line 1245)
   6.545 +JPEG compression:                              See 3.1.      (line  408)
   6.546 +KImageFuser:                                   See A.2.      (line 2427)
   6.547 +L*a*b* conversion:                             See 3.4.      (line  888)
   6.548 +laplacian edge detection:                      See 7.6.5.2.  (line 2099)
   6.549 +Laplacian of Gaussian (LoG):                   See 4.4.2.    (line 1357)
   6.550  lens distortion, correction of:                See 2.        (line  240)
   6.551 -levels, pyramid:                               See 3.1.      (line  330)
   6.552 -LibJPEG:                                       See 8.        (line 2198)
   6.553 -LibPNG:                                        See 8.        (line 2201)
   6.554 -LibTiff:                                       See 8.        (line 2205)
   6.555 -light probe:                                   See 7.3.2.    (line 1780)
   6.556 -local analysis window:                         See 4.4.1.    (line 1176)
   6.557 -local contrast enhancement:                    See 7.6.5.3.  (line 2007)
   6.558 -local contrast problem:                        See 7.6.5.1.  (line 1941)
   6.559 -local-contrast-based fusing:                   See 7.6.3.    (line 1868)
   6.560 -LZW compression:                               See 3.1.      (line  311)
   6.561 -mask template character, %:                    See 3.4.      (line  867)
   6.562 -mask template character, B:                    See 3.4.      (line  916)
   6.563 -mask template character, b:                    See 3.4.      (line  910)
   6.564 -mask template character, D:                    See 3.4.      (line  907)
   6.565 -mask template character, d:                    See 3.4.      (line  901)
   6.566 -mask template character, E:                    See 3.4.      (line  935)
   6.567 -mask template character, e:                    See 3.4.      (line  929)
   6.568 -mask template character, F:                    See 3.4.      (line  925)
   6.569 -mask template character, f:                    See 3.4.      (line  919)
   6.570 -mask template character, i:                    See 3.4.      (line  870)
   6.571 -mask template character, n:                    See 3.4.      (line  885)
   6.572 -mask template character, P:                    See 3.4.      (line  898)
   6.573 -mask template character, p:                    See 3.4.      (line  890)
   6.574 -mask template characters, table of:            See 3.4.      (line  866)
   6.575 -mask, binary:                                  See 5.        (line 1422)
   6.576 -mask, filename template:                       See 3.4.      (line  839)
   6.577 -mask, input files:                             See 5.1.      (line 1434)
   6.578 -mask, saving:                                  See 3.4.      (line  836)
   6.579 -mask, weight:                                  See 5.        (line 1422)
   6.580 -masks, understanding:                          See 5.        (line 1422)
   6.581 -memory, tuning usage of:                       See 6.        (line 1512)
   6.582 +levels, pyramid:                               See 3.1.      (line  442)
   6.583 +LibJPEG:                                       See 8.        (line 2310)
   6.584 +LibPNG:                                        See 8.        (line 2313)
   6.585 +LibTiff:                                       See 8.        (line 2317)
   6.586 +light probe:                                   See 7.3.2.    (line 1892)
   6.587 +literal filenames:                             See 3.        (line  284)
   6.588 +local analysis window:                         See 4.4.1.    (line 1288)
   6.589 +local contrast enhancement:                    See 7.6.5.3.  (line 2119)
   6.590 +local contrast problem:                        See 7.6.5.1.  (line 2053)
   6.591 +local-contrast-based fusing:                   See 7.6.3.    (line 1980)
   6.592 +LZW compression:                               See 3.1.      (line  423)
   6.593 +mask template character, %:                    See 3.4.      (line  979)
   6.594 +mask template character, B:                    See 3.4.      (line 1028)
   6.595 +mask template character, b:                    See 3.4.      (line 1022)
   6.596 +mask template character, D:                    See 3.4.      (line 1019)
   6.597 +mask template character, d:                    See 3.4.      (line 1013)
   6.598 +mask template character, E:                    See 3.4.      (line 1047)
   6.599 +mask template character, e:                    See 3.4.      (line 1041)
   6.600 +mask template character, F:                    See 3.4.      (line 1037)
   6.601 +mask template character, f:                    See 3.4.      (line 1031)
   6.602 +mask template character, i:                    See 3.4.      (line  982)
   6.603 +mask template character, n:                    See 3.4.      (line  997)
   6.604 +mask template character, P:                    See 3.4.      (line 1010)
   6.605 +mask template character, p:                    See 3.4.      (line 1002)
   6.606 +mask template characters, table of:            See 3.4.      (line  978)
   6.607 +mask, binary:                                  See 5.        (line 1534)
   6.608 +mask, filename template:                       See 3.4.      (line  951)
   6.609 +mask, input files:                             See 5.1.      (line 1546)
   6.610 +mask, saving:                                  See 3.4.      (line  948)
   6.611 +mask, weight:                                  See 5.        (line 1534)
   6.612 +masks, understanding:                          See 5.        (line 1534)
   6.613 +memory, tuning usage of:                       See 6.        (line 1624)
   6.614  Mertens-Kautz-Van Reeth exposure fusion:       See 1.        (line   97)
   6.615 -mode of operation (SDev, LoG, ...):            See 4.4.4.    (line 1349)
   6.616 +mode of operation (SDev, LoG, ...):            See 4.4.4.    (line 1461)
   6.617  multi-directory TIFF:                          See 1.        (line  163)
   6.618  multi-layer image:                             See 1.        (line  163)
   6.619 -natural sharp-unsharp transition:              See 7.6.6.    (line 2134)
   6.620 -noise reduction:                               See 7.2.      (line 1674)
   6.621 +natural sharp-unsharp transition:              See 7.6.6.    (line 2246)
   6.622 +noise reduction:                               See 7.2.      (line 1786)
   6.623  Octave:                                        See Appendix A.
   6.624 -                                                             (line 2225)
   6.625 -OpenEXR, data format:                          See 3.2.      (line  548)
   6.626 -OpenEXR, half precision float:                 See 3.2.      (line  552)
   6.627 -option delimiters:                             See 3.5.      (line  943)
   6.628 +                                                             (line 2337)
   6.629 +OpenEXR, data format:                          See 3.2.      (line  660)
   6.630 +OpenEXR, half precision float:                 See 3.2.      (line  664)
   6.631 +option delimiters:                             See 3.5.      (line 1055)
   6.632  option index:
   6.633 -          See ``Option Index''.                              (line 2870)
   6.634 -options, common:                               See 3.1.      (line  287)
   6.635 -options, expert:                               See 3.4.      (line  655)
   6.636 -options, extended:                             See 3.2.      (line  459)
   6.637 -options, fusion:                               See 3.3.      (line  596)
   6.638 -output file compression:                       See 3.1.      (line  290)
   6.639 -output filename, default:                      See 3.1.      (line  362)
   6.640 -output image, set size of:                     See 3.2.      (line  562)
   6.641 +          See ``Option Index''.                              (line 2983)
   6.642 +options, common:                               See 3.1.      (line  399)
   6.643 +options, expert:                               See 3.4.      (line  767)
   6.644 +options, extended:                             See 3.2.      (line  571)
   6.645 +options, fusion:                               See 3.3.      (line  708)
   6.646 +output file compression:                       See 3.1.      (line  402)
   6.647 +output filename, default:                      See 3.1.      (line  474)
   6.648 +output image, set size of:                     See 3.2.      (line  674)
   6.649  overview:                                      See 1.        (line   97)
   6.650 -packbits compression:                          See 3.1.      (line  315)
   6.651 +packbits compression:                          See 3.1.      (line  427)
   6.652  parallax error:                                See 2.        (line  250)
   6.653  photometric alignment:                         See 2.        (line  242)
   6.654 -pixels, hot:                                   See 7.6.6.    (line 2119)
   6.655 -polarization series:                           See 7.5.      (line 1806)
   6.656 -probability function:                          See 4.4.1.1.  (line 1207)
   6.657 +pixels, hot:                                   See 7.6.6.    (line 2231)
   6.658 +polarization series:                           See 7.5.      (line 1918)
   6.659 +probability function:                          See 4.4.1.1.  (line 1319)
   6.660  problem reports:                               See Appendix A.
   6.661 -                                                             (line 2228)
   6.662 -problem, local contrast:                       See 7.6.5.1.  (line 1941)
   6.663 -profile, ICC:                                  See 3.2.      (line  476)
   6.664 +                                                             (line 2340)
   6.665 +problem, local contrast:                       See 7.6.5.1.  (line 2053)
   6.666 +profile, ICC:                                  See 3.2.      (line  588)
   6.667  program index:
   6.668 -          See ``Program Index''.                             (line 2829)
   6.669 -programs, helpful additional:                  See 8.        (line 2141)
   6.670 -pyramid levels:                                See 3.1.      (line  330)
   6.671 +          See ``Program Index''.                             (line 2942)
   6.672 +programs, helpful additional:                  See 8.        (line 2253)
   6.673 +pyramid levels:                                See 3.1.      (line  442)
   6.674  raw conversion:                                See 2.        (line  227)
   6.675 -saturation enhancement:                        See 7.5.      (line 1806)
   6.676 -scaling of parameters:                         See 4.4.4.    (line 1349)
   6.677 -sensor, use of clean:                          See 7.6.6.    (line 2110)
   6.678 -series, exposure:                              See 7.3.      (line 1696)
   6.679 -series, flash exposure:                        See 7.4.      (line 1799)
   6.680 -series, polarization:                          See 7.5.      (line 1806)
   6.681 -series, simple:                                See 7.2.      (line 1674)
   6.682 -simple series:                                 See 7.2.      (line 1674)
   6.683 -single precision float, IEEE754:               See 3.2.      (line  528)
   6.684 +response file, format:                         See 3.        (line  332)
   6.685 +response file, grammar:                        See 3.        (line  346)
   6.686 +response files:                                See 3.        (line  284)
   6.687 +saturation enhancement:                        See 7.5.      (line 1918)
   6.688 +scaling of parameters:                         See 4.4.4.    (line 1461)
   6.689 +sensor, use of clean:                          See 7.6.6.    (line 2222)
   6.690 +series, exposure:                              See 7.3.      (line 1808)
   6.691 +series, flash exposure:                        See 7.4.      (line 1911)
   6.692 +series, polarization:                          See 7.5.      (line 1918)
   6.693 +series, simple:                                See 7.2.      (line 1786)
   6.694 +simple series:                                 See 7.2.      (line 1786)
   6.695 +single precision float, IEEE754:               See 3.2.      (line  640)
   6.696  SourceForge <1>:                               See Appendix A.
   6.697 -                                                             (line 2231)
   6.698 +                                                             (line 2343)
   6.699  SourceForge:                                   See 1.        (line  169)
   6.700  SourceForge, tracker:                          See Appendix A.
   6.701 -                                                             (line 2231)
   6.702 -sRGB color space:                              See 3.2.      (line  476)
   6.703 -standard deviation:                            See 4.4.1.1.  (line 1216)
   6.704 -statistical moments:                           See 4.4.1.1.  (line 1207)
   6.705 -subtraction of dark frame:                     See 7.6.6.    (line 2119)
   6.706 -sweet spot aperture:                           See 7.6.1.    (line 1843)
   6.707 +                                                             (line 2343)
   6.708 +sRGB color space:                              See 3.2.      (line  588)
   6.709 +standard deviation:                            See 4.4.1.1.  (line 1328)
   6.710 +statistical moments:                           See 4.4.1.1.  (line 1319)
   6.711 +subtraction of dark frame:                     See 7.6.6.    (line 2231)
   6.712 +sweet spot aperture:                           See 7.6.1.    (line 1955)
   6.713  TIFF, multi-directory:                         See 1.        (line  163)
   6.714  tiffcopy:                                      See 1.        (line  163)
   6.715  tiffsplit:                                     See 1.        (line  163)
   6.716 -tips, focus stacking experts:                  See 7.6.6.    (line 2107)
   6.717 -TMPDIR:                                        See 6.        (line 1526)
   6.718 +tips, focus stacking experts:                  See 7.6.6.    (line 2219)
   6.719 +TMPDIR:                                        See 6.        (line 1638)
   6.720  tracker, SourceForge:                          See Appendix A.
   6.721 -                                                             (line 2231)
   6.722 +                                                             (line 2343)
   6.723  transformation, affine:                        See 2.        (line  240)
   6.724 -transition, natural sharp-unsharp:             See 7.6.6.    (line 2134)
   6.725 -understanding masks:                           See 5.        (line 1422)
   6.726 -variance:                                      See 4.4.1.1.  (line 1213)
   6.727 -weight mask:                                   See 5.        (line 1422)
   6.728 -weight, entropy:                               See 3.3.      (line  607)
   6.729 -weight, exposure:                              See 3.3.      (line  615)
   6.730 -weight, local contrast:                        See 3.3.      (line  600)
   6.731 -weighted average:                              See 4.1.1.    (line 1031)
   6.732 -weighting functions:                           See 4.        (line  990)
   6.733 -weighting, contrast using a blend of methods:  See 4.4.3.    (line 1307)
   6.734 -weighting, contrast using laplacian-of-gaussian:See 4.4.2.   (line 1245)
   6.735 -weighting, contrast using standard deviation:  See 4.4.1.    (line 1176)
   6.736 -weighting, exposure <1>:                       See 4.2.      (line 1063)
   6.737 +transition, natural sharp-unsharp:             See 7.6.6.    (line 2246)
   6.738 +understanding masks:                           See 5.        (line 1534)
   6.739 +variance:                                      See 4.4.1.1.  (line 1325)
   6.740 +weight mask:                                   See 5.        (line 1534)
   6.741 +weight, entropy:                               See 3.3.      (line  719)
   6.742 +weight, exposure:                              See 3.3.      (line  727)
   6.743 +weight, local contrast:                        See 3.3.      (line  712)
   6.744 +weighted average:                              See 4.1.1.    (line 1143)
   6.745 +weighting functions:                           See 4.        (line 1102)
   6.746 +weighting, contrast using a blend of methods:  See 4.4.3.    (line 1419)
   6.747 +weighting, contrast using laplacian-of-gaussian:See 4.4.2.   (line 1357)
   6.748 +weighting, contrast using standard deviation:  See 4.4.1.    (line 1288)
   6.749 +weighting, exposure <1>:                       See 4.2.      (line 1175)
   6.750  weighting, exposure:                           See 1.        (line  121)
   6.751 -weighting, general concept of:                 See 4.1.      (line  997)
   6.752 -weighting, local contrast <1>:                 See 4.4.      (line 1152)
   6.753 +weighting, general concept of:                 See 4.1.      (line 1109)
   6.754 +weighting, local contrast <1>:                 See 4.4.      (line 1264)
   6.755  weighting, local contrast:                     See 1.        (line  130)
   6.756 -weighting, local entropy <1>:                  See 4.5.      (line 1363)
   6.757 +weighting, local entropy <1>:                  See 4.5.      (line 1475)
   6.758  weighting, local entropy:                      See 1.        (line  135)
   6.759 -weighting, saturation <1>:                     See 4.3.      (line 1117)
   6.760 +weighting, saturation <1>:                     See 4.3.      (line 1229)
   6.761  weighting, saturation:                         See 1.        (line  126)
   6.762 -window, local-analysis:                        See 4.4.1.    (line 1176)
   6.763 +window, local-analysis:                        See 4.4.1.    (line 1288)
   6.764  workflow:                                      See 2.        (line  192)
   6.765  workflow with Enblend:                         See 2.        (line  203)
   6.766  workflow with Enfuse:                          See 2.        (line  203)
   6.767 -wrap around:                                   See 3.1.      (line  409)
   6.768 +wrap around:                                   See 3.1.      (line  521)
     7.1 --- a/doc/enfuse.texi	Tue Nov 03 13:56:24 2009 +0100
     7.2 +++ b/doc/enfuse.texi	Fri Nov 06 09:42:01 2009 +0100
     7.3 @@ -356,6 +356,8 @@
     7.4  Fuse the sequence of images @var{INPUT}@dots{} into a single
     7.5  @var{IMAGE}.
     7.6  
     7.7 +@include filespec.texi
     7.8 +
     7.9  @menu
    7.10  * Common Options::              General options
    7.11  * Extended Options::            Memory control and others
    7.12 @@ -540,7 +542,7 @@
    7.13  mask generation, pyramid, and blending
    7.14  
    7.15  @item 3
    7.16 -color conversions
    7.17 +reading of response files, color conversions
    7.18  
    7.19  @item 4
    7.20  image sizes, bounding boxes and intersection sizes
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/doc/filespec.texi	Fri Nov 06 09:42:01 2009 +0100
     8.3 @@ -0,0 +1,173 @@
     8.4 +@cindex literal filenames
     8.5 +@cindex filenames, literal
     8.6 +@cindex response files
     8.7 +Input images are either specified literally or via so-called response
     8.8 +files.  A response file contains filenames of images or other response
     8.9 +filenames.  Introduce response file names with an at-character
    8.10 +(@samp{@@}).
    8.11 +
    8.12 +Enblend and Enfuse process the list @var{INPUT}... from left to right,
    8.13 +expanding response files depth-first.  The following examples only show
    8.14 +Enblend, but Enfuse works exactly the same.
    8.15 +
    8.16 +@table @asis
    8.17 +@item Solely literal filenames.
    8.18 +Example:
    8.19 +@example
    8.20 +enblend image-1.tif image-2.tif image-3.tif
    8.21 +@end example
    8.22 +
    8.23 +The ultimate order in which the images are processed is:
    8.24 +@file{image-1.tif}, @file{image-2.tif}, @file{image-3.tif}.
    8.25 +
    8.26 +@item Single response file.
    8.27 +Example:
    8.28 +@example
    8.29 +enblend @@list
    8.30 +@end example
    8.31 +where file@tie{}@file{list} contains
    8.32 +@example
    8.33 +img1.exr
    8.34 +img2.exr
    8.35 +img3.exr
    8.36 +img4.exr
    8.37 +@end example
    8.38 +
    8.39 +Ultimate order: @file{img1.exr}, @file{img2.exr}, @file{img3.exr},
    8.40 +@file{img4.exr}.
    8.41 +
    8.42 +@item Mixed literal names and response files.
    8.43 +Example:
    8.44 +@example
    8.45 +enblend @@master.list image-09.png image-10.png
    8.46 +@end example
    8.47 +where file@tie{}@file{master.list} comprises of
    8.48 +@example
    8.49 +image-01.png
    8.50 +@@first.list
    8.51 +image-04.png
    8.52 +@@second.list
    8.53 +image-08.png
    8.54 +@end example
    8.55 +@file{first.list} is
    8.56 +@example
    8.57 +image-02.png
    8.58 +image-03.png
    8.59 +@end example
    8.60 +and @file{second.list} contains
    8.61 +@example
    8.62 +image-05.png
    8.63 +image-06.png
    8.64 +image-07.png
    8.65 +@end example
    8.66 +
    8.67 +Ultimate order: @file{image-01.png}, @file{image-02.png},
    8.68 +@file{image-03.png}, @file{image-04.png}, @file{image-05.png},
    8.69 +@file{image-06.png}, @file{image-07.png}, @file{image-08.png},
    8.70 +@file{image-09.png}, @file{image-10.png},
    8.71 +@end table
    8.72 +
    8.73 +@sp 1
    8.74 +@noindent
    8.75 +@strong{Response File Format}
    8.76 +@cindex response file, format
    8.77 +@cindex format of response files
    8.78 +@need 150
    8.79 +Response files contain one filename per line.  Blank lines or lines
    8.80 +beginning with a sharp sign (@samp{#}) are ignored.  Filenames that
    8.81 +begin with an at-character (@samp{@@}) denote other response files.
    8.82 +@ref{Table:response-file-format} states a formal grammar of response
    8.83 +files in @uref{http://@/en.wikipedia.org/@/wiki/@/Ebnf,
    8.84 +@acronym{EBNF}}.
    8.85 +
    8.86 +@float Table,Table:response-file-format
    8.87 +@multitable {@var{response-file}} {::=} {abcdefghijklmnopqrstuvwxyzabcdefghijklm}
    8.88 +@item @var{response-file}
    8.89 +@tab ::=
    8.90 +@tab @var{line}*
    8.91 +@item @var{line}
    8.92 +@tab ::=
    8.93 +@tab (@var{comment} | @var{file-spec}) [@samp{\r}] @samp{\n}
    8.94 +@item @var{comment}
    8.95 +@tab ::=
    8.96 +@tab @var{space}* @samp{#} @var{text}
    8.97 +@item @var{file-spec}
    8.98 +@tab ::=
    8.99 +@tab @var{space}* @samp{@@} @var{filename} @var{space}*
   8.100 +@item @var{space}
   8.101 +@tab ::=
   8.102 +@tab @samp{ } | @samp{\t}
   8.103 +@end multitable
   8.104 +
   8.105 +@noindent
   8.106 +where @var{text} is an arbitrary string and @var{filename} is any
   8.107 +filename.
   8.108 +
   8.109 +@caption{@acronym{EBNF} definition of the grammar of response files.}
   8.110 +@shortcaption{Response-file grammar}
   8.111 +
   8.112 +@cindex response file, grammar
   8.113 +@cindex grammar, response file
   8.114 +@end float
   8.115 +
   8.116 +In a response file all relative filenames are used relative the the
   8.117 +response file itself, not relative to the current-working directory of
   8.118 +the application.
   8.119 +
   8.120 +@noindent
   8.121 +The above grammar might unpleasantly surprise the user in the
   8.122 +some ways:
   8.123 +
   8.124 +@table @asis
   8.125 +@item Literal filenames
   8.126 +Inside a response file all filenames are treated as literals.  No
   8.127 +filename globing or expansion is performed.  This is, the
   8.128 +line
   8.129 +@example
   8.130 +img_*.tif
   8.131 +@end example
   8.132 +stands for exactly one file called @samp{img_*.tif}.
   8.133 +
   8.134 +@item Whitespace trimmed at both line ends
   8.135 +For convenience whitespace at the beginning and at the end of each
   8.136 +line is ignored.  However, this implies that response files cannot
   8.137 +represent filenames that start or end with whitespace, as there is no
   8.138 +quoting syntax.  Filenames with embedded whatespace cause no problems,
   8.139 +though.
   8.140 +
   8.141 +@item Only whole-line comments
   8.142 +Comments in response files always occupy a complete line.  There are
   8.143 +no line-ending comments.  Thus in
   8.144 +@example
   8.145 +# exposure series
   8.146 +img-0.33ev.tif # "middle" EV
   8.147 +img-1.33ev.tif
   8.148 +img+0.67ev.tif
   8.149 +@end example
   8.150 +only the first line contains a comment, whereas the second lines
   8.151 +includes none.  Rather it refers to file@tie{}@w{@samp{img-0.33ev.tif
   8.152 +# "middle" EV}}.
   8.153 +
   8.154 +@item Image filenames cannot start with @samp{@@}
   8.155 +An at-sign always introduces a response file, even if the extension
   8.156 +would hinto towards an image.
   8.157 +@end table
   8.158 +
   8.159 +@noindent
   8.160 +Here is an example of a valid response file.
   8.161 +@example
   8.162 +@group
   8.163 +# 4\pi panorama!
   8.164 +
   8.165 +# These pictures were taken with the panorama head.
   8.166 +@@round-shots.list
   8.167 +
   8.168 +# Freehand sky shot.
   8.169 +zenith.tif
   8.170 +
   8.171 +# "Legs, will you go away?" images.
   8.172 +nadir-2.tif
   8.173 +nadir-5.tif
   8.174 +nadir.tif
   8.175 +@end group
   8.176 +@end example
     9.1 --- a/doc/versenblend.texi	Tue Nov 03 13:56:24 2009 +0100
     9.2 +++ b/doc/versenblend.texi	Fri Nov 06 09:42:01 2009 +0100
     9.3 @@ -1,4 +1,4 @@
     9.4 -@set UPDATED 31 October 2009
     9.5 -@set UPDATED-MONTH October 2009
     9.6 +@set UPDATED 5 November 2009
     9.7 +@set UPDATED-MONTH November 2009
     9.8  @set EDITION 4.0-dd32463fe9de
     9.9  @set VERSION 4.0-dd32463fe9de
    10.1 --- a/doc/versenfuse.texi	Tue Nov 03 13:56:24 2009 +0100
    10.2 +++ b/doc/versenfuse.texi	Fri Nov 06 09:42:01 2009 +0100
    10.3 @@ -1,4 +1,4 @@
    10.4 -@set UPDATED 31 October 2009
    10.5 -@set UPDATED-MONTH October 2009
    10.6 +@set UPDATED 5 November 2009
    10.7 +@set UPDATED-MONTH November 2009
    10.8  @set EDITION 4.0-dd32463fe9de
    10.9  @set VERSION 4.0-dd32463fe9de
    11.1 --- a/src/Makefile.am	Tue Nov 03 13:56:24 2009 +0100
    11.2 +++ b/src/Makefile.am	Fri Nov 06 09:42:01 2009 +0100
    11.3 @@ -11,7 +11,9 @@
    11.4                    common.h enblend.h enblend.cc fixmath.h \
    11.5                    float_cast.h global.h gpu.cc gpu.h mask.h \
    11.6                    nearest.h numerictraits.h openmp.h path.h pyramid.h \
    11.7 +                  error_message.h error_message.cc \
    11.8                    filenameparse.h filenameparse.cc \
    11.9 +                  filespec.h filespec.cc \
   11.10                    self_test.h self_test.cc \
   11.11                    tiff_message.h tiff_message.cc
   11.12  enblend_LDFLAGS = $(AM_LDFLAGS) $(OPENGL_CFLAGS)
   11.13 @@ -23,7 +25,9 @@
   11.14  enfuse_SOURCES = assemble.h blend.h bounds.h common.h \
   11.15                   enfuse.h enfuse.cc fixmath.h float_cast.h \
   11.16                   global.h mga.h numerictraits.h openmp.h pyramid.h \
   11.17 +                 error_message.h error_message.cc \
   11.18                   filenameparse.h filenameparse.cc \
   11.19 +                 filespec.h filespec.cc \
   11.20                   self_test.h self_test.cc \
   11.21                   tiff_message.h tiff_message.cc
   11.22  enfuse_LDFLAGS = $(AM_LDFLAGS)
    12.1 --- a/src/common.h	Tue Nov 03 13:56:24 2009 +0100
    12.2 +++ b/src/common.h	Fri Nov 06 09:42:01 2009 +0100
    12.3 @@ -29,8 +29,11 @@
    12.4  #include <algorithm>
    12.5  #include <fstream>
    12.6  #include <iomanip>
    12.7 +#include <limits>
    12.8  #include <map>
    12.9  #include <stdexcept>
   12.10 +#include <string>
   12.11 +#include <vector>
   12.12  
   12.13  #include <boost/assign/list_inserter.hpp>
   12.14  #include <boost/assign/list_of.hpp>
   12.15 @@ -39,6 +42,7 @@
   12.16  
   12.17  #include "vigra/numerictraits.hxx"
   12.18  
   12.19 +#include "error_message.h"
   12.20  #include "filenameparse.h"
   12.21  
   12.22  #define NUMERIC_OPTION_DELIMITERS ";:/"
   12.23 @@ -189,38 +193,6 @@
   12.24  }
   12.25  
   12.26  
   12.27 -/** Answer the error message associated with anErrorNumber.
   12.28 - */
   12.29 -std::string
   12.30 -errorMessage(int anErrorNumber)
   12.31 -{
   12.32 -#if HAVE_STRERROR_R || HAVE_STRERROR
   12.33 -#if HAVE_STRERROR_R
   12.34 -    const size_t size = 4096;
   12.35 -    boost::scoped_ptr<char> message_buffer(new char[size]);
   12.36 -    const char* message = strerror_r(anErrorNumber, message_buffer.get(), size);
   12.37 -#elif HAVE_STRERROR
   12.38 -    const char* message = strerror(anErrorNumber);
   12.39 -#endif
   12.40 -
   12.41 -    if (strlen(message) == 0)
   12.42 -    {
   12.43 -        std::ostringstream oss;
   12.44 -        oss << "No error message available, error #" << anErrorNumber;
   12.45 -        return oss.str();
   12.46 -    }
   12.47 -    else
   12.48 -    {
   12.49 -        return std::string(message);
   12.50 -    }
   12.51 -#else
   12.52 -    std::ostringstream oss;
   12.53 -    oss << "No error message available, error #" << anErrorNumber;
   12.54 -    return oss.str();
   12.55 -#endif
   12.56 -}
   12.57 -
   12.58 -
   12.59  /** Answer aString converted to uppercase letters. */
   12.60  std::string
   12.61  toUppercase(const std::string& aString)
   12.62 @@ -249,11 +221,9 @@
   12.63  }
   12.64  
   12.65  
   12.66 -/** Try to open aFilename.  Exit with a nicely formatted error
   12.67 - *  message, if opening fails.  Otherwise immediately close the
   12.68 - *  handle. */
   12.69 -void
   12.70 -try_opening_file(const std::string& aFilename)
   12.71 +/** Answer whether we can open aFilename. */
   12.72 +bool
   12.73 +can_open_file(const std::string& aFilename)
   12.74  {
   12.75      errno = 0;
   12.76      std::ifstream file(aFilename.c_str());
   12.77 @@ -262,7 +232,7 @@
   12.78          std::cerr << command <<
   12.79              ": failed to open \"" << aFilename << "\": " <<
   12.80              errorMessage(errno) << "\n";
   12.81 -        exit(1);
   12.82 +        return false;
   12.83      }
   12.84      else
   12.85      {
   12.86 @@ -274,6 +244,7 @@
   12.87                  ": info: problems when closing \"" << aFilename << "\": " <<
   12.88                  errorMessage(errno) << "\n";
   12.89          }
   12.90 +        return true;
   12.91      }
   12.92  }
   12.93  
    13.1 --- a/src/enblend.cc	Tue Nov 03 13:56:24 2009 +0100
    13.2 +++ b/src/enblend.cc	Fri Nov 06 09:42:01 2009 +0100
    13.3 @@ -151,6 +151,7 @@
    13.4  Signature sig;
    13.5  
    13.6  #include "common.h"
    13.7 +#include "filespec.h"
    13.8  #include "enblend.h"
    13.9  #ifdef HAVE_LIBGLEW
   13.10  #include "gpu.h"
   13.11 @@ -179,6 +180,8 @@
   13.12  using vigra::Rect2D;
   13.13  using vigra::StdException;
   13.14  
   13.15 +using enblend::FileNameList;
   13.16 +using enblend::TraceableFileNameList;
   13.17  using enblend::enblendMain;
   13.18  
   13.19  #ifdef _WIN32
   13.20 @@ -1261,10 +1264,6 @@
   13.21      TIFFSetWarningHandler(tiff_warning);
   13.22      TIFFSetErrorHandler(tiff_error);
   13.23  
   13.24 -    // List of input files.
   13.25 -    list<char*> inputFileNameList;
   13.26 -    list<char*>::iterator inputFileNameIterator;
   13.27 -
   13.28      if (!getopt_long_works_ok())
   13.29      {
   13.30          cerr << command << ": cannot reliably parse command line; giving up\n";
   13.31 @@ -1281,45 +1280,19 @@
   13.32          exit(1);
   13.33      }
   13.34  
   13.35 +    TraceableFileNameList inputTraceableFileNameList;
   13.36 +
   13.37      // Remaining parameters are input files.
   13.38 -    if (optind < argc) {
   13.39 -        while (optind < argc) {
   13.40 -#ifdef _WIN32
   13.41 -            // There has got to be an easier way...
   13.42 -            char drive[_MAX_DRIVE];
   13.43 -            char dir[_MAX_DIR];
   13.44 -            char fname[_MAX_FNAME];
   13.45 -            char ext[_MAX_EXT];
   13.46 -            char newFile[_MAX_PATH];
   13.47 +    while (optind < argc) {
   13.48 +        TraceableFileNameList files;
   13.49 +        enblend::unfold_filename(files, std::string(argv[optind]));
   13.50 +        inputTraceableFileNameList.insert(inputTraceableFileNameList.end(),
   13.51 +                                          files.begin(), files.end());
   13.52 +        optind++;
   13.53 +    }
   13.54  
   13.55 -            _splitpath(argv[optind], drive, dir, NULL, NULL);
   13.56 -
   13.57 -            struct _finddata_t finddata;
   13.58 -            intptr_t findhandle;
   13.59 -            int stop = 0;
   13.60 -
   13.61 -            findhandle = _findfirst(argv[optind], &finddata);
   13.62 -            if (findhandle != -1) {
   13.63 -                do {
   13.64 -                    _splitpath(finddata.name, NULL, NULL, fname, ext);
   13.65 -                    _makepath(newFile, drive, dir, fname, ext);
   13.66 -
   13.67 -                    // TODO (jbeda): This will leak -- the right way to
   13.68 -                    // fix this is to make this a list of std::string.
   13.69 -                    // I'll look into this after we get things working
   13.70 -                    // on Win32
   13.71 -                    inputFileNameList.push_back(strdup(newFile));
   13.72 -                } while (_findnext(findhandle, &finddata) == 0);
   13.73 -                _findclose(findhandle);
   13.74 -            }
   13.75 -
   13.76 -            optind++;
   13.77 -#else
   13.78 -            inputFileNameList.push_back(argv[optind++]);
   13.79 -#endif
   13.80 -        }
   13.81 -    } else {
   13.82 -        cerr << command << ": no input files specified.\n";
   13.83 +    if (inputTraceableFileNameList.empty()) {
   13.84 +        cerr << command << ": no input files specified\n";
   13.85          exit(1);
   13.86      }
   13.87  
   13.88 @@ -1358,33 +1331,50 @@
   13.89      Rect2D inputUnion;
   13.90  
   13.91      // Check that all input images have the same parameters.
   13.92 -    inputFileNameIterator = inputFileNameList.begin();
   13.93      int minDim = INT_MAX;
   13.94      unsigned layer = 0;
   13.95      unsigned layers = 0;
   13.96 -    while (inputFileNameIterator != inputFileNameList.end()) {
   13.97 +    FileNameList inputFileNameList;
   13.98 +    TraceableFileNameList::iterator inputFileNameIterator = inputTraceableFileNameList.begin();
   13.99 +    while (inputFileNameIterator != inputTraceableFileNameList.end()) {
  13.100          ImageImportInfo* inputInfo = NULL;
  13.101 -        {
  13.102 -            std::string filename(*inputFileNameIterator);
  13.103 -            enblend::try_opening_file(filename);
  13.104 +        std::string filename(inputFileNameIterator->first);
  13.105 +        if (!enblend::can_open_file(filename)) {
  13.106 +            enblend::unroll_trace(inputFileNameIterator->second);
  13.107 +            exit(1);
  13.108 +        }
  13.109 +        try {
  13.110              ImageImportInfo info(filename.c_str());
  13.111              if (layers == 0) { // OPTIMIZATION: call only once per file
  13.112                  layers = info.numLayers();
  13.113              }
  13.114              if (layers >= 2) {
  13.115 -                filename = vigra::join_filename_layer(*inputFileNameIterator, layer);
  13.116 +                filename = vigra::join_filename_layer(filename, layer);
  13.117 +                inputInfo = new ImageImportInfo(filename.c_str());
  13.118 +            } else {
  13.119 +                inputInfo = new ImageImportInfo(info);
  13.120              }
  13.121              ++layer;
  13.122 -            inputInfo = new ImageImportInfo(filename.c_str());
  13.123 +        } catch (vigra::PreconditionViolation) {
  13.124 +            cerr <<
  13.125 +                command << ": cannot load image \"" << filename << "\", because the\n" <<
  13.126 +                command << ":     format of the file is unrecognized or unknown\n";
  13.127 +            if (enblend::maybe_response_file(filename)) {
  13.128 +                cerr <<
  13.129 +                    command << ": info: Maybe you meant a response file and forgot the initial '" <<
  13.130 +                    RESPONSE_FILE_PREFIX_CHAR << "'?\n";
  13.131 +            }
  13.132 +            exit(1);
  13.133          }
  13.134  
  13.135          // Save this image info in the list.
  13.136          imageInfoList.push_back(inputInfo);
  13.137 +        inputFileNameList.push_back(filename);
  13.138  
  13.139          if (Verbose >= VERBOSE_INPUT_IMAGE_INFO_MESSAGES) {
  13.140              cerr << command
  13.141                   << ": info: input image \""
  13.142 -                 << *inputFileNameIterator
  13.143 +                 << inputFileNameIterator->first
  13.144                   << "\" "
  13.145                   << layer << '/' << layers << ' ';
  13.146  
  13.147 @@ -1412,10 +1402,11 @@
  13.148          if (inputInfo->numExtraBands() < 1) {
  13.149              // Complain about lack of alpha channel.
  13.150              cerr << command
  13.151 -                 << ": input image \"" << *inputFileNameIterator << "\""
  13.152 +                 << ": input image \"" << inputFileNameIterator->first << "\""
  13.153                   << enblend::optional_layer_name(layer, layers)
  13.154                   << " does not have an alpha channel"
  13.155                   << endl;
  13.156 +            enblend::unroll_trace(inputFileNameIterator->second);
  13.157              exit(1);
  13.158          }
  13.159  
  13.160 @@ -1423,7 +1414,7 @@
  13.161          Rect2D imageROI(Point2D(inputInfo->getPosition()),
  13.162                          Size2D(inputInfo->width(), inputInfo->height()));
  13.163  
  13.164 -        if (inputFileNameIterator == inputFileNameList.begin()) {
  13.165 +        if (inputFileNameIterator == inputTraceableFileNameList.begin()) {
  13.166              // First input image
  13.167              minDim = std::min(inputInfo->width(), inputInfo->height());
  13.168              inputUnion = imageROI;
  13.169 @@ -1437,8 +1428,9 @@
  13.170                  if (InputProfile == NULL) {
  13.171                      cerr << endl
  13.172                           << command << ": error parsing ICC profile data from file \""
  13.173 -                         << *inputFileNameIterator
  13.174 +                         << inputFileNameIterator->first
  13.175                           << "\"" << enblend::optional_layer_name(layer, layers) << endl;
  13.176 +                    enblend::unroll_trace(inputFileNameIterator->second);
  13.177                      exit(1);
  13.178                  }
  13.179              }
  13.180 @@ -1448,34 +1440,37 @@
  13.181  
  13.182              if (isColor != inputInfo->isColor()) {
  13.183                  cerr << command << ": input image \""
  13.184 -                     << *inputFileNameIterator << "\""
  13.185 +                     << inputFileNameIterator->first << "\""
  13.186                       << enblend::optional_layer_name(layer, layers) << " is "
  13.187                       << (inputInfo->isColor() ? "color" : "grayscale") << "\n"
  13.188                       << command << ":   but previous images are "
  13.189                       << (isColor ? "color" : "grayscale")
  13.190                       << endl;
  13.191 +                enblend::unroll_trace(inputFileNameIterator->second);
  13.192                  exit(1);
  13.193              }
  13.194              if (pixelType != inputInfo->getPixelType()) {
  13.195                  cerr << command << ": input image \""
  13.196 -                     << *inputFileNameIterator << "\""
  13.197 +                     << inputFileNameIterator->first << "\""
  13.198                       << enblend::optional_layer_name(layer, layers) << " has pixel type "
  13.199                       << inputInfo->getPixelType() << ",\n"
  13.200                       << command << ":   but previous images have pixel type "
  13.201                       << pixelType
  13.202                       << endl;
  13.203 +                enblend::unroll_trace(inputFileNameIterator->second);
  13.204                  exit(1);
  13.205              }
  13.206              if (resolution !=
  13.207                  TiffResolution(inputInfo->getXResolution(), inputInfo->getYResolution())) {
  13.208                  cerr << command << ": info: input image \""
  13.209 -                     << *inputFileNameIterator << "\""
  13.210 +                     << inputFileNameIterator->first << "\""
  13.211                       << enblend::optional_layer_name(layer, layers) << " has resolution "
  13.212                       << inputInfo->getXResolution() << " dpi x "
  13.213                       << inputInfo->getYResolution() << " dpi,\n"
  13.214                       << command << ": info:   but first image has resolution "
  13.215                       << resolution.x << " dpi x " << resolution.y << " dpi"
  13.216                       << endl;
  13.217 +                enblend::unroll_trace(inputFileNameIterator->second);
  13.218              }
  13.219              if (!std::equal(iccProfile.begin(),
  13.220                              iccProfile.end(),
  13.221 @@ -1488,33 +1483,36 @@
  13.222                      if (newProfile == NULL) {
  13.223                          cerr << endl
  13.224                               << command << ": error parsing ICC profile data from file \""
  13.225 -                             << *inputFileNameIterator
  13.226 +                             << inputFileNameIterator->first
  13.227                               << "\"" << enblend::optional_layer_name(layer, layers) << endl;
  13.228 +                        enblend::unroll_trace(inputFileNameIterator->second);
  13.229                          exit(1);
  13.230                      }
  13.231                  }
  13.232  
  13.233                  cerr << endl << command << ": input image \""
  13.234 -                     << *inputFileNameIterator
  13.235 -                     << "\"" << enblend::optional_layer_name(layer, layers) << " has ";
  13.236 +                     << inputFileNameIterator->first
  13.237 +                     << "\"" << enblend::optional_layer_name(layer, layers) << "\n";
  13.238 +                enblend::unroll_trace(inputFileNameIterator->second);
  13.239 +                cerr << command << ":     has ";
  13.240                  if (newProfile) {
  13.241 -                    cerr << " ICC profile \""
  13.242 +                    cerr << "ICC profile \""
  13.243                           << cmsTakeProductName(newProfile)
  13.244                           << " "
  13.245                           << cmsTakeProductDesc(newProfile)
  13.246                           << "\"";
  13.247                  } else {
  13.248 -                    cerr << " no ICC profile";
  13.249 +                    cerr << "no ICC profile";
  13.250                  }
  13.251 -                cerr << " but previous images have ";
  13.252 +                cerr << ", but previous images have ";
  13.253                  if (InputProfile) {
  13.254 -                    cerr << " ICC profile \""
  13.255 +                    cerr << "ICC profile \""
  13.256                           << cmsTakeProductName(InputProfile)
  13.257                           << " "
  13.258                           << cmsTakeProductDesc(InputProfile)
  13.259                           << "\"" << endl;
  13.260                  } else {
  13.261 -                    cerr << " no ICC profile" << endl;
  13.262 +                    cerr << "no ICC profile" << endl;
  13.263                  }
  13.264                  cerr << command
  13.265                       << ": warning: blending images with different color spaces\n"
  13.266 @@ -1540,12 +1538,12 @@
  13.267          {
  13.268              // We are about to process the next layer in the _same_
  13.269              // image.  The imageInfoList already has been updated, but
  13.270 -            // inputFileNameList still lacks the filename.
  13.271 -            inputFileNameList.insert(inputFileNameIterator, *inputFileNameIterator);
  13.272 +            // inputTraceableFileNameList still lacks the filename.
  13.273 +            inputTraceableFileNameList.insert(inputFileNameIterator, *inputFileNameIterator);
  13.274          }
  13.275      }
  13.276  
  13.277 -    vigra_postcondition(imageInfoList.size() == inputFileNameList.size(),
  13.278 +    vigra_postcondition(imageInfoList.size() == inputTraceableFileNameList.size(),
  13.279                          "filename list and image info list are inconsistent");
  13.280  
  13.281      // Check that more than one input file was given.
  13.282 @@ -1562,7 +1560,7 @@
  13.283      if (resolution == TiffResolution()) {
  13.284          cerr << command
  13.285               << ": warning: no usable resolution found in first image \""
  13.286 -             << *inputFileNameList.begin() << "\";\n"
  13.287 +             << inputTraceableFileNameList.begin()->first << "\";\n"
  13.288               << command
  13.289               << ": warning:   will use " << DEFAULT_TIFF_RESOLUTION << " dpi"
  13.290               << endl;
    14.1 --- a/src/enblend.h	Tue Nov 03 13:56:24 2009 +0100
    14.2 +++ b/src/enblend.h	Fri Nov 06 09:42:01 2009 +0100
    14.3 @@ -65,7 +65,7 @@
    14.4  /** Enblend's main blending loop. Templatized to handle different image types.
    14.5   */
    14.6  template <typename ImagePixelType>
    14.7 -void enblendMain(const list<char*>& anInputFileNameList,
    14.8 +void enblendMain(const FileNameList& anInputFileNameList,
    14.9                   const list<ImageImportInfo*>& anImageInfoList,
   14.10                   ImageExportInfo& anOutputImageInfo,
   14.11                   Rect2D& anInputUnion)
   14.12 @@ -121,7 +121,7 @@
   14.13  
   14.14      // Main blending loop.
   14.15      unsigned m = 0;
   14.16 -    list<char*>::const_iterator inputFileNameIterator(anInputFileNameList.begin());
   14.17 +    FileNameList::const_iterator inputFileNameIterator(anInputFileNameList.begin());
   14.18      while (!imageInfoList.empty()) {
   14.19          // Create the white image.
   14.20          Rect2D whiteBB;
    15.1 --- a/src/enblend_msvc2008.vcproj	Tue Nov 03 13:56:24 2009 +0100
    15.2 +++ b/src/enblend_msvc2008.vcproj	Fri Nov 06 09:42:01 2009 +0100
    15.3 @@ -390,10 +390,18 @@
    15.4  				>
    15.5  			</File>
    15.6  			<File
    15.7 +				RelativePath=".\error_message.cc"
    15.8 +				>
    15.9 +			</File>
   15.10 +			<File
   15.11  				RelativePath=".\filenameparse.cc"
   15.12  				>
   15.13  			</File>
   15.14  			<File
   15.15 +				RelativePath=".\filespec.cc"
   15.16 +				>
   15.17 +			</File>
   15.18 +			<File
   15.19  				RelativePath=".\win32helpers\getopt.c"
   15.20  				>
   15.21  			</File>
   15.22 @@ -440,10 +448,18 @@
   15.23  				>
   15.24  			</File>
   15.25  			<File
   15.26 +				RelativePath=".\error_message.h"
   15.27 +				>
   15.28 +			</File>
   15.29 +			<File
   15.30  				RelativePath=".\filenameparse.h"
   15.31  				>
   15.32  			</File>
   15.33  			<File
   15.34 +				RelativePath=".\filespec.h"
   15.35 +				>
   15.36 +			</File>
   15.37 +			<File
   15.38  				RelativePath=".\fixmath.h"
   15.39  				>
   15.40  			</File>
    16.1 --- a/src/enfuse.cc	Tue Nov 03 13:56:24 2009 +0100
    16.2 +++ b/src/enfuse.cc	Fri Nov 06 09:42:01 2009 +0100
    16.3 @@ -165,6 +165,8 @@
    16.4  using vigra::Rect2D;
    16.5  using vigra::StdException;
    16.6  
    16.7 +using enblend::FileNameList;
    16.8 +using enblend::TraceableFileNameList;
    16.9  using enblend::enfuseMain;
   16.10  
   16.11  #ifdef _WIN32
   16.12 @@ -1345,10 +1347,6 @@
   16.13      TIFFSetWarningHandler(tiff_warning);
   16.14      TIFFSetErrorHandler(tiff_error);
   16.15  
   16.16 -    // List of input files.
   16.17 -    list<char*> inputFileNameList;
   16.18 -    list<char*>::iterator inputFileNameIterator;
   16.19 -
   16.20      if (!getopt_long_works_ok())
   16.21      {
   16.22          cerr << command << ": cannot reliably parse command line; giving up\n";
   16.23 @@ -1365,45 +1363,19 @@
   16.24          exit(1);
   16.25      }
   16.26  
   16.27 +    TraceableFileNameList inputTraceableFileNameList;
   16.28 +
   16.29      // Remaining parameters are input files.
   16.30 -    if (optind < argc) {
   16.31 -        while (optind < argc) {
   16.32 -#ifdef _WIN32
   16.33 -            // There has got to be an easier way...
   16.34 -            char drive[_MAX_DRIVE];
   16.35 -            char dir[_MAX_DIR];
   16.36 -            char fname[_MAX_FNAME];
   16.37 -            char ext[_MAX_EXT];
   16.38 -            char newFile[_MAX_PATH];
   16.39 +    while (optind < argc) {
   16.40 +        TraceableFileNameList files;
   16.41 +        enblend::unfold_filename(files, std::string(argv[optind]));
   16.42 +        inputTraceableFileNameList.insert(inputTraceableFileNameList.end(),
   16.43 +                                          files.begin(), files.end());
   16.44 +        optind++;
   16.45 +    }
   16.46  
   16.47 -            _splitpath(argv[optind], drive, dir, NULL, NULL);
   16.48 -
   16.49 -            struct _finddata_t finddata;
   16.50 -            intptr_t findhandle;
   16.51 -            int stop = 0;
   16.52 -
   16.53 -            findhandle = _findfirst(argv[optind], &finddata);
   16.54 -            if (findhandle != -1) {
   16.55 -                do {
   16.56 -                    _splitpath(finddata.name, NULL, NULL, fname, ext);
   16.57 -                    _makepath(newFile, drive, dir, fname, ext);
   16.58 -
   16.59 -                    // TODO (jbeda): This will leak -- the right way to
   16.60 -                    // fix this is to make this a list of std::string.
   16.61 -                    // I'll look into this after we get things working
   16.62 -                    // on Win32
   16.63 -                    inputFileNameList.push_back(strdup(newFile));
   16.64 -                } while (_findnext(findhandle, &finddata) == 0);
   16.65 -                _findclose(findhandle);
   16.66 -            }
   16.67 -
   16.68 -            optind++;
   16.69 -#else
   16.70 -            inputFileNameList.push_back(argv[optind++]);
   16.71 -#endif
   16.72 -        }
   16.73 -    } else {
   16.74 -        cerr << command << ": no input files specified.\n";
   16.75 +    if (inputTraceableFileNameList.empty()) {
   16.76 +        cerr << command << ": no input files specified\n";
   16.77          exit(1);
   16.78      }
   16.79  
   16.80 @@ -1424,31 +1396,49 @@
   16.81      Rect2D inputUnion;
   16.82  
   16.83      // Check that all input images have the same parameters.
   16.84 -    inputFileNameIterator = inputFileNameList.begin();
   16.85      unsigned layer = 0;
   16.86      unsigned layers = 0;
   16.87 -    while (inputFileNameIterator != inputFileNameList.end()) {
   16.88 +    FileNameList inputFileNameList;
   16.89 +    TraceableFileNameList::iterator inputFileNameIterator = inputTraceableFileNameList.begin();
   16.90 +    while (inputFileNameIterator != inputTraceableFileNameList.end()) {
   16.91          ImageImportInfo* inputInfo = NULL;
   16.92 -        {
   16.93 -            std::string filename(*inputFileNameIterator);
   16.94 -            enblend::try_opening_file(filename);
   16.95 +        std::string filename(inputFileNameIterator->first);
   16.96 +        if (!enblend::can_open_file(filename)) {
   16.97 +            enblend::unroll_trace(inputFileNameIterator->second);
   16.98 +            exit(1);
   16.99 +        }
  16.100 +        try {
  16.101              ImageImportInfo info(filename.c_str());
  16.102              if (layers == 0) { // OPTIMIZATION: call only once per file
  16.103                  layers = info.numLayers();
  16.104              }
  16.105              if (layers >= 2) {
  16.106 -                filename = vigra::join_filename_layer(*inputFileNameIterator, layer);
  16.107 +                filename = vigra::join_filename_layer(inputFileNameIterator->first, layer);
  16.108 +                inputInfo = new ImageImportInfo(filename.c_str());
  16.109 +            } else {
  16.110 +                inputInfo = new ImageImportInfo(info);
  16.111              }
  16.112              ++layer;
  16.113 -            inputInfo = new ImageImportInfo(filename.c_str());
  16.114 +        } catch (vigra::PreconditionViolation) {
  16.115 +            cerr <<
  16.116 +                command << ": cannot load image \"" << filename << "\", because the\n" <<
  16.117 +                command << ":     format of the file is unrecognized or unknown\n";
  16.118 +            if (enblend::maybe_response_file(filename)) {
  16.119 +                cerr <<
  16.120 +                    command << ": info: Maybe you meant a response file and forgot the initial '" <<
  16.121 +                    RESPONSE_FILE_PREFIX_CHAR << "'?\n";
  16.122 +            }
  16.123 +            exit(1);
  16.124          }
  16.125 +
  16.126          // Save this image info in the list.
  16.127          imageInfoList.push_back(inputInfo);
  16.128 +        inputFileNameList.push_back(filename);
  16.129  
  16.130          if (Verbose >= VERBOSE_INPUT_IMAGE_INFO_MESSAGES) {
  16.131              cerr << command
  16.132                   << ": info: input image \""
  16.133 -                 << *inputFileNameIterator
  16.134 +                 << inputFileNameIterator->first
  16.135                   << "\" "
  16.136                   << layer << '/' << layers << ' ';
  16.137  
  16.138 @@ -1476,10 +1466,11 @@
  16.139          if (inputInfo->numExtraBands() < 1) {
  16.140              // Complain about lack of alpha channel.
  16.141              cerr << command
  16.142 -                 << ": info: input image \"" << *inputFileNameIterator << "\""
  16.143 +                 << ": info: input image \"" << inputFileNameIterator->first << "\""
  16.144                   << enblend::optional_layer_name(layer, layers)
  16.145 -                 << " does not have an alpha channel;\n"
  16.146 -                 << command
  16.147 +                 << " does not have an alpha channel;\n";
  16.148 +            enblend::unroll_trace(inputFileNameIterator->second);
  16.149 +            cerr << command
  16.150                   << ": info: assuming all pixels should contribute to the final image"
  16.151                   << endl;
  16.152          }
  16.153 @@ -1488,7 +1479,7 @@
  16.154          Rect2D imageROI(Point2D(inputInfo->getPosition()),
  16.155                          Size2D(inputInfo->width(), inputInfo->height()));
  16.156  
  16.157 -        if (inputFileNameIterator == inputFileNameList.begin()) {
  16.158 +        if (inputFileNameIterator == inputTraceableFileNameList.begin()) {
  16.159              // First input image
  16.160              inputUnion = imageROI;
  16.161              isColor = inputInfo->isColor();
  16.162 @@ -1501,8 +1492,9 @@
  16.163                  if (InputProfile == NULL) {
  16.164                      cerr << endl
  16.165                           << command << ": error parsing ICC profile data from file \""
  16.166 -                         << *inputFileNameIterator
  16.167 +                         << inputFileNameIterator->first
  16.168                           << "\"" << enblend::optional_layer_name(layer, layers) << endl;
  16.169 +                    enblend::unroll_trace(inputFileNameIterator->second);
  16.170                      exit(1);
  16.171                  }
  16.172              }
  16.173 @@ -1512,34 +1504,37 @@
  16.174  
  16.175              if (isColor != inputInfo->isColor()) {
  16.176                  cerr << command << ": input image \""
  16.177 -                     << *inputFileNameIterator << "\""
  16.178 +                     << inputFileNameIterator->first << "\""
  16.179                       << enblend::optional_layer_name(layer, layers) << " is "
  16.180                       << (inputInfo->isColor() ? "color" : "grayscale") << "\n"
  16.181                       << command << ":   but previous images are "
  16.182                       << (isColor ? "color" : "grayscale")
  16.183                       << endl;
  16.184 +                enblend::unroll_trace(inputFileNameIterator->second);
  16.185                  exit(1);
  16.186              }
  16.187              if (pixelType != inputInfo->getPixelType()) {
  16.188                  cerr << command << ": input image \""
  16.189 -                     << *inputFileNameIterator << "\""
  16.190 +                     << inputFileNameIterator->first << "\""
  16.191                       << enblend::optional_layer_name(layer, layers) << " has pixel type "
  16.192                       << inputInfo->getPixelType() << ",\n"
  16.193                       << command << ":   but previous images have pixel type "
  16.194                       << pixelType
  16.195                       << endl;
  16.196 +                enblend::unroll_trace(inputFileNameIterator->second);
  16.197                  exit(1);
  16.198              }
  16.199              if (resolution !=
  16.200                  TiffResolution(inputInfo->getXResolution(), inputInfo->getYResolution())) {
  16.201                  cerr << command << ": info: input image \""
  16.202 -                     << *inputFileNameIterator << "\""
  16.203 +                     << inputFileNameIterator->first << "\""
  16.204                       << enblend::optional_layer_name(layer, layers) << " has resolution "
  16.205                       << inputInfo->getXResolution() << " dpi x "
  16.206                       << inputInfo->getYResolution() << " dpi,\n"
  16.207                       << command << ": info:   but first image has resolution "
  16.208                       << resolution.x << " dpi x " << resolution.y << " dpi"
  16.209                       << endl;
  16.210 +                enblend::unroll_trace(inputFileNameIterator->second);
  16.211              }
  16.212              if (!std::equal(iccProfile.begin(),
  16.213                              iccProfile.end(),
  16.214 @@ -1552,33 +1547,36 @@
  16.215                      if (newProfile == NULL) {
  16.216                          cerr << endl
  16.217                               << command << ": error parsing ICC profile data from file \""
  16.218 -                             << *inputFileNameIterator
  16.219 +                             << inputFileNameIterator->first
  16.220                               << "\"" << enblend::optional_layer_name(layer, layers) << endl;
  16.221 +                        enblend::unroll_trace(inputFileNameIterator->second);
  16.222                          exit(1);
  16.223                      }
  16.224                  }
  16.225  
  16.226                  cerr << endl << command << ": input image \""
  16.227 -                     << *inputFileNameIterator
  16.228 -                     << "\"" << enblend::optional_layer_name(layer, layers) << " has ";
  16.229 +                     << inputFileNameIterator->first
  16.230 +                     << "\"" << enblend::optional_layer_name(layer, layers) << "\n";
  16.231 +                enblend::unroll_trace(inputFileNameIterator->second);
  16.232 +                cerr << command << ":     has ";
  16.233                  if (newProfile) {
  16.234 -                    cerr << " ICC profile \""
  16.235 +                    cerr << "ICC profile \""
  16.236                           << cmsTakeProductName(newProfile)
  16.237                           << " "
  16.238                           << cmsTakeProductDesc(newProfile)
  16.239                           << "\"";
  16.240                  } else {
  16.241 -                    cerr << " no ICC profile";
  16.242 +                    cerr << "no ICC profile";
  16.243                  }
  16.244 -                cerr << " but previous images have ";
  16.245 +                cerr << ", but previous images have ";
  16.246                  if (InputProfile) {
  16.247 -                    cerr << " ICC profile \""
  16.248 +                    cerr << "ICC profile \""
  16.249                           << cmsTakeProductName(InputProfile)
  16.250                           << " "
  16.251                           << cmsTakeProductDesc(InputProfile)
  16.252                           << "\"" << endl;
  16.253                  } else {
  16.254 -                    cerr << " no ICC profile" << endl;
  16.255 +                    cerr << "no ICC profile" << endl;
  16.256                  }
  16.257                  cerr << command
  16.258                       << ": warning: blending images with different color spaces\n"
  16.259 @@ -1598,12 +1596,12 @@
  16.260          {
  16.261              // We are about to process the next layer in the _same_
  16.262              // image.  The imageInfoList already has been updated, but
  16.263 -            // inputFileNameList still lacks the filename.
  16.264 -            inputFileNameList.insert(inputFileNameIterator, *inputFileNameIterator);
  16.265 +            // inputTraceableFileNameList still lacks the filename.
  16.266 +            inputTraceableFileNameList.insert(inputFileNameIterator, *inputFileNameIterator);
  16.267          }
  16.268      }
  16.269  
  16.270 -    vigra_postcondition(imageInfoList.size() == inputFileNameList.size(),
  16.271 +    vigra_postcondition(imageInfoList.size() == inputTraceableFileNameList.size(),
  16.272                          "filename list and image info list are inconsistent");
  16.273  
  16.274      // Check that more than one input file was given.
  16.275 @@ -1620,7 +1618,7 @@
  16.276      if (resolution == TiffResolution()) {
  16.277          cerr << command
  16.278               << ": warning: no usable resolution found in first image \""
  16.279 -             << *inputFileNameList.begin() << "\";\n"
  16.280 +             << inputTraceableFileNameList.begin()->first << "\";\n"
  16.281               << command
  16.282               << ": warning:   will use " << DEFAULT_TIFF_RESOLUTION << " dpi"
  16.283               << endl;
    17.1 --- a/src/enfuse.h	Tue Nov 03 13:56:24 2009 +0100
    17.2 +++ b/src/enfuse.h	Fri Nov 06 09:42:01 2009 +0100
    17.3 @@ -32,6 +32,7 @@
    17.4  #include <boost/static_assert.hpp>
    17.5  
    17.6  #include "common.h"
    17.7 +#include "filespec.h"
    17.8  #include "openmp.h"
    17.9  #include "numerictraits.h"
   17.10  #include "fixmath.h"
   17.11 @@ -1131,7 +1132,7 @@
   17.12  /** Enfuse's main blending loop. Templatized to handle different image types.
   17.13   */
   17.14  template <typename ImagePixelType>
   17.15 -void enfuseMain(const list<char*>& anInputFileNameList,
   17.16 +void enfuseMain(const FileNameList& anInputFileNameList,
   17.17                  const list<ImageImportInfo*>& anImageInfoList,
   17.18                  ImageExportInfo& anOutputImageInfo,
   17.19                  Rect2D& anInputUnion)
   17.20 @@ -1168,7 +1169,7 @@
   17.21      const unsigned numberOfImages = imageInfoList.size();
   17.22  
   17.23      unsigned m = 0;
   17.24 -    list<char*>::const_iterator inputFileNameIterator(anInputFileNameList.begin());
   17.25 +    FileNameList::const_iterator inputFileNameIterator(anInputFileNameList.begin());
   17.26      while (!imageInfoList.empty()) {
   17.27          Rect2D imageBB;
   17.28          pair<ImageType*, AlphaType*> imagePair =
    18.1 --- a/src/enfuse_msvc2008.vcproj	Tue Nov 03 13:56:24 2009 +0100
    18.2 +++ b/src/enfuse_msvc2008.vcproj	Fri Nov 06 09:42:01 2009 +0100
    18.3 @@ -386,10 +386,18 @@
    18.4  				>
    18.5  			</File>
    18.6  			<File
    18.7 +				RelativePath=".\error_message.cc"
    18.8 +				>
    18.9 +			</File>
   18.10 +			<File
   18.11  				RelativePath=".\filenameparse.cc"
   18.12  				>
   18.13  			</File>
   18.14  			<File
   18.15 +				RelativePath=".\filespec.cc"
   18.16 +				>
   18.17 +			</File>
   18.18 +			<File
   18.19  				RelativePath=".\win32helpers\getopt.c"
   18.20  				>
   18.21  			</File>
   18.22 @@ -436,10 +444,18 @@
   18.23  				>
   18.24  			</File>
   18.25  			<File
   18.26 +				RelativePath=".\error_message.h"
   18.27 +				>
   18.28 +			</File>
   18.29 +			<File
   18.30  				RelativePath=".\filenameparse.h"
   18.31  				>
   18.32  			</File>
   18.33  			<File
   18.34 +				RelativePath=".\filespec.h"
   18.35 +				>
   18.36 +			</File>
   18.37 +			<File
   18.38  				RelativePath=".\fixmath.h"
   18.39  				>
   18.40  			</File>
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/src/error_message.cc	Fri Nov 06 09:42:01 2009 +0100
    19.3 @@ -0,0 +1,44 @@
    19.4 +#include <cstring>
    19.5 +#include <sstream>
    19.6 +
    19.7 +#include <boost/scoped_ptr.hpp>
    19.8 +
    19.9 +#ifdef HAVE_CONFIG_H
   19.10 +#include <config.h>
   19.11 +#endif
   19.12 +
   19.13 +#include "error_message.h"
   19.14 +
   19.15 +namespace enblend
   19.16 +{
   19.17 +
   19.18 +std::string
   19.19 +errorMessage(int anErrorNumber)
   19.20 +{
   19.21 +#if HAVE_STRERROR_R || HAVE_STRERROR
   19.22 +#if HAVE_STRERROR_R
   19.23 +    const size_t size = 4096;
   19.24 +    boost::scoped_ptr<char> message_buffer(new char[size]);
   19.25 +    const char* message = strerror_r(anErrorNumber, message_buffer.get(), size);
   19.26 +#elif HAVE_STRERROR
   19.27 +    const char* message = strerror(anErrorNumber);
   19.28 +#endif
   19.29 +
   19.30 +    if (strlen(message) == 0)
   19.31 +    {
   19.32 +        std::ostringstream oss;
   19.33 +        oss << "No detailed error message available, error #" << anErrorNumber;
   19.34 +        return oss.str();
   19.35 +    }
   19.36 +    else
   19.37 +    {
   19.38 +        return std::string(message);
   19.39 +    }
   19.40 +#else
   19.41 +    std::ostringstream oss;
   19.42 +    oss << "No detailed error message available, error #" << anErrorNumber;
   19.43 +    return oss.str();
   19.44 +#endif
   19.45 +}
   19.46 +
   19.47 +}
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/src/error_message.h	Fri Nov 06 09:42:01 2009 +0100
    20.3 @@ -0,0 +1,35 @@
    20.4 +/*
    20.5 + * Copyright (C) 2009 Dr. Christoph L. Spiel
    20.6 + *
    20.7 + * This file is part of Enblend.
    20.8 + *
    20.9 + * Enblend is free software; you can redistribute it and/or modify
   20.10 + * it under the terms of the GNU General Public License as published by
   20.11 + * the Free Software Foundation; either version 2 of the License, or
   20.12 + * (at your option) any later version.
   20.13 + *
   20.14 + * Enblend is distributed in the hope that it will be useful,
   20.15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
   20.16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   20.17 + * GNU General Public License for more details.
   20.18 + *
   20.19 + * You should have received a copy of the GNU General Public License
   20.20 + * along with Enblend; if not, write to the Free Software
   20.21 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   20.22 + */
   20.23 +#ifndef __ERROR_MESSAGE_H__
   20.24 +#define __ERROR_MESSAGE_H__
   20.25 +
   20.26 +#include <string>
   20.27 +
   20.28 +namespace enblend
   20.29 +{
   20.30 +    /** Answer the error message associated with anErrorNumber. */
   20.31 +    std::string errorMessage(int anErrorNumber);
   20.32 +}
   20.33 +
   20.34 +#endif /* __ERROR_MESSAGE_H__ */
   20.35 +
   20.36 +// Local Variables:
   20.37 +// mode: c++
   20.38 +// End:
    21.1 --- a/src/filenameparse.cc	Tue Nov 03 13:56:24 2009 +0100
    21.2 +++ b/src/filenameparse.cc	Fri Nov 06 09:42:01 2009 +0100
    21.3 @@ -22,8 +22,15 @@
    21.4  // Life is tough and then you die.  -- Jack Dempsey
    21.5  
    21.6  
    21.7 +#include <list>
    21.8  #include <string>
    21.9  
   21.10 +#if _WIN32
   21.11 +#ifndef HAVE_BOOST_FILESYSTEM
   21.12 +#include <ctype.h>  // isalpha
   21.13 +#endif
   21.14 +#endif
   21.15 +
   21.16  #ifdef HAVE_CONFIG_H
   21.17  #include <config.h>
   21.18  #endif
   21.19 @@ -36,6 +43,9 @@
   21.20  #define PATH_SEPARATOR "/"
   21.21  #endif
   21.22  
   21.23 +#define DOT "."
   21.24 +#define DOTDOT ".."
   21.25 +
   21.26  
   21.27  #ifdef HAVE_BOOST_FILESYSTEM
   21.28  #include <boost/filesystem.hpp>
   21.29 @@ -46,16 +56,36 @@
   21.30  
   21.31  namespace enblend {
   21.32  
   21.33 +bool
   21.34 +isRelativePath(const std::string& aFilename)
   21.35 +{
   21.36 +#ifdef HAVE_BOOST_FILESYSTEM
   21.37 +    const basic_path path(aFilename);
   21.38 +    return !path.has_root_directory();
   21.39 +#else
   21.40 +    const std::string::size_type separator = aFilename.find(PATH_SEPARATOR);
   21.41 +#if defined(_MSC_VER) || defined(HAVE_WINDOWS_H)
   21.42 +    return !(aFilename.size() >= 3 &&
   21.43 +             isalpha(aFilename[0]) &&
   21.44 +             aFilename[1] == ':' &&
   21.45 +             separator == 2);
   21.46 +#else
   21.47 +    return separator != 0;
   21.48 +#endif
   21.49 +#endif
   21.50 +}
   21.51 +
   21.52 +
   21.53  std::string
   21.54  extractDirname(const std::string& aFilename)
   21.55  {
   21.56  #ifdef HAVE_BOOST_FILESYSTEM
   21.57      const basic_path path(aFilename);
   21.58      const std::string directory(path.branch_path().string());
   21.59 -    return directory.empty() ? "." : directory;
   21.60 +    return directory.empty() ? DOT : directory;
   21.61  #else
   21.62      const std::string::size_type separator = aFilename.rfind(PATH_SEPARATOR);
   21.63 -    return (separator == std::string::npos) ? "." : aFilename.substr(0, separator);
   21.64 +    return (separator == std::string::npos) ? DOT : aFilename.substr(0, separator);
   21.65  #endif
   21.66  }
   21.67  
   21.68 @@ -84,7 +114,7 @@
   21.69      return basename(path);
   21.70  #else
   21.71      const std::string::size_type separator = aFilename.rfind(PATH_SEPARATOR);
   21.72 -    const std::string::size_type dot = aFilename.rfind(".");
   21.73 +    const std::string::size_type dot = aFilename.rfind(DOT);
   21.74      if (separator == std::string::npos)
   21.75      {
   21.76          return (dot == std::string::npos) ? aFilename : aFilename.substr(0, dot);
   21.77 @@ -107,7 +137,7 @@
   21.78      const basic_path path(aFilename);
   21.79      return extension(path);
   21.80  #else
   21.81 -    const std::string::size_type dot = aFilename.rfind(".");
   21.82 +    const std::string::size_type dot = aFilename.rfind(DOT);
   21.83      return
   21.84          (dot == std::string::npos) ?
   21.85          "" :
   21.86 @@ -115,6 +145,222 @@
   21.87  #endif
   21.88  }
   21.89  
   21.90 +
   21.91 +typedef std::list<std::string> list_t;
   21.92 +
   21.93 +
   21.94 +#ifdef HAVE_BOOST_FILESYSTEM
   21.95 +
   21.96 +inline basic_path
   21.97 +removeDotsBoost(const basic_path& aPath)
   21.98 +{
   21.99 +    basic_path result;
  21.100 +    for (basic_path::const_iterator p = aPath.begin(); p != aPath.end(); ++p)
  21.101 +    {
  21.102 +        if (*p != DOT)
  21.103 +        {
  21.104 +            result /= *p;
  21.105 +        }
  21.106 +    }
  21.107 +    return result;
  21.108 +}
  21.109 +
  21.110 +
  21.111 +inline basic_path
  21.112 +removeDotDotsBoost(const basic_path& aPath)
  21.113 +{
  21.114 +    list_t directories;
  21.115 +    for (basic_path::const_iterator p = aPath.begin(); p != aPath.end(); ++p)
  21.116 +    {
  21.117 +        if (*p == DOTDOT &&
  21.118 +            !directories.empty() && directories.back() != DOTDOT)
  21.119 +        {
  21.120 +            directories.pop_back();
  21.121 +        }
  21.122 +        else
  21.123 +        {
  21.124 +            directories.push_back(*p);
  21.125 +        }
  21.126 +    }
  21.127 +    basic_path result;
  21.128 +    for (list_t::const_iterator p = directories.begin(); p != directories.end(); ++p)
  21.129 +    {
  21.130 +        result /= *p;
  21.131 +    }
  21.132 +    return result;
  21.133 +}
  21.134 +
  21.135 +#else
  21.136 +
  21.137 +inline
  21.138 +std::string
  21.139 +removeDotsCxx(const std::string& aPathname)
  21.140 +{
  21.141 +    std::string path(aPathname);
  21.142 +    std::string::size_type predecessor = std::string::npos;
  21.143 +    std::string::size_type separator = path.find(PATH_SEPARATOR);
  21.144 +    while (separator != std::string::npos)
  21.145 +    {
  21.146 +        const std::string::size_type begin =
  21.147 +            predecessor == std::string::npos ? 0 : predecessor + 1;
  21.148 +        const std::string component =
  21.149 +            path.substr(begin, separator - predecessor - 1);
  21.150 +        if (component == DOT)
  21.151 +        {
  21.152 +            path.erase(begin, 2);
  21.153 +        }
  21.154 +        else
  21.155 +        {
  21.156 +            predecessor = separator;
  21.157 +        }
  21.158 +        separator = path.find(PATH_SEPARATOR, predecessor + 1);
  21.159 +    }
  21.160 +    if (predecessor == std::string::npos)
  21.161 +    {
  21.162 +        if (path == DOT)
  21.163 +        {
  21.164 +            path.clear();
  21.165 +        }
  21.166 +    }
  21.167 +    else
  21.168 +    {
  21.169 +        const std::string component = path.substr(predecessor + 1);
  21.170 +        if (component == DOT)
  21.171 +        {
  21.172 +            path.erase(predecessor);
  21.173 +        }
  21.174 +    }
  21.175 +    return path;
  21.176 +}
  21.177 +
  21.178 +
  21.179 +inline std::string
  21.180 +removeDotDotsCxx(const std::string& aPathname)
  21.181 +{
  21.182 +    std::string path(aPathname);
  21.183 +    list_t directories;
  21.184 +    std::string::size_type predecessor = std::string::npos;
  21.185 +    std::string::size_type separator = path.find(PATH_SEPARATOR);
  21.186 +    while (separator != std::string::npos)
  21.187 +    {
  21.188 +        const std::string::size_type begin =
  21.189 +            predecessor == std::string::npos ? 0 : predecessor + 1;
  21.190 +        const std::string component =
  21.191 +            path.substr(begin, separator - predecessor - 1);
  21.192 +        if (component == DOTDOT &&
  21.193 +            !directories.empty() && directories.back() != DOTDOT)
  21.194 +        {
  21.195 +            directories.pop_back();
  21.196 +        }
  21.197 +        else
  21.198 +        {
  21.199 +            directories.push_back(component);
  21.200 +        }
  21.201 +
  21.202 +        predecessor = separator;
  21.203 +        separator = path.find(PATH_SEPARATOR, predecessor + 1);
  21.204 +    }
  21.205 +    if (predecessor == std::string::npos)
  21.206 +    {
  21.207 +        directories.push_back(path);
  21.208 +    }
  21.209 +    else
  21.210 +    {
  21.211 +        const std::string component = path.substr(predecessor + 1);
  21.212 +        if (component == DOTDOT &&
  21.213 +            !directories.empty() && directories.back() != DOTDOT)
  21.214 +        {
  21.215 +            directories.pop_back();
  21.216 +        }
  21.217 +        else
  21.218 +        {
  21.219 +            directories.push_back(component);
  21.220 +        }
  21.221 +    }
  21.222 +    std::string result;
  21.223 +    for (list_t::const_iterator p = directories.begin(); p != directories.end(); ++p)
  21.224 +    {
  21.225 +        if (p != directories.begin())
  21.226 +        {
  21.227 +            result.append(PATH_SEPARATOR);
  21.228 +        }
  21.229 +        result.append(*p);
  21.230 +    }
  21.231 +    return result;
  21.232 +}
  21.233 +#endif
  21.234 +
  21.235 +
  21.236 +std::string
  21.237 +canonicalizePath(const std::string& aPathname, bool keepDot)
  21.238 +{
  21.239 +#ifdef HAVE_BOOST_FILESYSTEM
  21.240 +    const basic_path result =
  21.241 +        removeDotDotsBoost(removeDotsBoost(basic_path(aPathname)));
  21.242 +    if (keepDot && result.empty())
  21.243 +    {
  21.244 +        return std::string(DOT);
  21.245 +    }
  21.246 +    else
  21.247 +    {
  21.248 +        return result.string();
  21.249 +    }
  21.250 +#else
  21.251 +    std::string result = removeDotDotsCxx(removeDotsCxx(aPathname));
  21.252 +
  21.253 +    // For compatability with the Boost implementation: Remove a
  21.254 +    // trailing PATH_SEPARATOR unless we reference the root directory.
  21.255 +    const size_t size = result.size();
  21.256 +    if (size >= 2 && result.substr(size - 1, 1) == PATH_SEPARATOR)
  21.257 +    {
  21.258 +        result.erase(size - 1, 1);
  21.259 +    }
  21.260 +    if (keepDot && result.empty())
  21.261 +    {
  21.262 +        return std::string(DOT);
  21.263 +    }
  21.264 +    else
  21.265 +    {
  21.266 +        return result;
  21.267 +    }
  21.268 +#endif
  21.269 +}
  21.270 +
  21.271 +
  21.272 +std::string
  21.273 +concatPath(const std::string& aPathname, const std::string& anotherPathname)
  21.274 +{
  21.275 +#ifdef HAVE_BOOST_FILESYSTEM
  21.276 +    basic_path path(aPathname);
  21.277 +    basic_path leaf(anotherPathname);
  21.278 +    path /= leaf;
  21.279 +    return path.string();
  21.280 +#else
  21.281 +    if (aPathname.empty())
  21.282 +    {
  21.283 +        return anotherPathname;
  21.284 +    }
  21.285 +    else if (anotherPathname.empty())
  21.286 +    {
  21.287 +        return aPathname;
  21.288 +    }
  21.289 +    else
  21.290 +    {
  21.291 +        const std::string::size_type end = aPathname.find_last_not_of(PATH_SEPARATOR);
  21.292 +        const std::string path =
  21.293 +            (end == std::string::npos) ?
  21.294 +            aPathname :
  21.295 +            aPathname.substr(0, end + 1);
  21.296 +        const std::string::size_type begin = anotherPathname.find_first_not_of(PATH_SEPARATOR);
  21.297 +        const std::string leaf =
  21.298 +            (begin == std::string::npos) ?
  21.299 +            anotherPathname :
  21.300 +            anotherPathname.substr(begin);
  21.301 +        return path + PATH_SEPARATOR + leaf;
  21.302 +    }
  21.303 +#endif
  21.304 +}
  21.305 +
  21.306  } // namespace enblend
  21.307  
  21.308  // Local Variables:
    22.1 --- a/src/filenameparse.h	Tue Nov 03 13:56:24 2009 +0100
    22.2 +++ b/src/filenameparse.h	Fri Nov 06 09:42:01 2009 +0100
    22.3 @@ -23,6 +23,10 @@
    22.4  #include <string>
    22.5  
    22.6  namespace enblend {
    22.7 +    /** Answer whether aFilename is specified with a relative path not
    22.8 +     *  an absolute one. */
    22.9 +    bool isRelativePath(const std::string& aFilename);
   22.10 +
   22.11      /** Answer the directory part of aFilename.  The function duplicates
   22.12       *  dirname(1). */
   22.13      std::string extractDirname(const std::string& aFilename);
   22.14 @@ -38,6 +42,15 @@
   22.15      /** Answer the extension part of aFilename including the leading
   22.16       *  dot. */
   22.17      std::string extractExtension(const std::string& aFilename);
   22.18 +
   22.19 +    /** Answer aPathname with all superfluous "." and ".." removed.
   22.20 +     *  If keepDot is true an empty path gets normalized to "."
   22.21 +     *  instead of the empty string. */
   22.22 +    std::string canonicalizePath(const std::string& aPathname, bool keepDot);
   22.23 +
   22.24 +    /** Answer the concatenation of aPathname and anotherPathname. */
   22.25 +    std::string concatPath(const std::string& aPathname,
   22.26 +                           const std::string& anotherPathname);
   22.27  } // namespace enblend
   22.28  
   22.29  #endif /* __FILENAMEPARSE_H__ */
    23.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.2 +++ b/src/filespec.cc	Fri Nov 06 09:42:01 2009 +0100
    23.3 @@ -0,0 +1,749 @@
    23.4 +/*
    23.5 + * Copyright (C) 2009 Christoph L. Spiel
    23.6 + *
    23.7 + * This file is part of Enblend.
    23.8 + *
    23.9 + * Enblend is free software; you can redistribute it and/or modify
   23.10 + * it under the terms of the GNU General Public License as published by
   23.11 + * the Free Software Foundation; either version 2 of the License, or
   23.12 + * (at your option) any later version.
   23.13 + *
   23.14 + * Enblend is distributed in the hope that it will be useful,
   23.15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
   23.16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   23.17 + * GNU General Public License for more details.
   23.18 + *
   23.19 + * You should have received a copy of the GNU General Public License
   23.20 + * along with Enblend; if not, write to the Free Software
   23.21 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   23.22 + */
   23.23 +
   23.24 +
   23.25 +#include <cerrno>
   23.26 +#include <fstream>
   23.27 +#include <iostream>
   23.28 +#include <list>
   23.29 +#include <map>
   23.30 +
   23.31 +//#define WANT_WILDCARD_GLOBBING
   23.32 +
   23.33 +#ifdef WANT_WILDCARD_GLOBBING
   23.34 +#ifdef _WIN32
   23.35 +// ...
   23.36 +#else
   23.37 +#include <glob.h>
   23.38 +#include <unistd.h>
   23.39 +#endif // _WIN32
   23.40 +#endif // WANT_WILDCARD_GLOBBING
   23.41 +
   23.42 +#ifdef _WIN32
   23.43 +#include <io.h>
   23.44 +#endif
   23.45 +
   23.46 +#include <boost/assign/list_of.hpp>
   23.47 +
   23.48 +
   23.49 +#ifdef _WIN32
   23.50 +// FIXME: Defines lrint() for fast fromRealPromotes and _must_ be
   23.51 +// included before "vigra/imageinfo.hxx".  This is ugly beyond belief!
   23.52 +#include "float_cast.h"
   23.53 +#endif
   23.54 +
   23.55 +#include "vigra/imageinfo.hxx"
   23.56 +
   23.57 +#ifdef HAVE_CONFIG_H
   23.58 +#include <config.h>
   23.59 +#endif
   23.60 +
   23.61 +#include "global.h"
   23.62 +#include "error_message.h"
   23.63 +#include "filenameparse.h"
   23.64 +#include "filespec.h"
   23.65 +
   23.66 +
   23.67 +// How many lines at the beginning of a response file we check to
   23.68 +// guess that it actually is a response file.
   23.69 +#define RESPONSE_FILE_LINES_TO_CHECK 20U
   23.70 +
   23.71 +
   23.72 +// Separator of key and value in a syntactic comment
   23.73 +#define KEY_VALUE_SEPARATOR_CHAR ':'
   23.74 +
   23.75 +
   23.76 +typedef std::pair<std::string, std::string> key_value_pair;
   23.77 +
   23.78 +
   23.79 +extern const std::string command;
   23.80 +extern int Verbose;
   23.81 +
   23.82 +
   23.83 +namespace enblend
   23.84 +{
   23.85 +
   23.86 +#ifdef _WIN32
   23.87 +/** Add all files which match filename to filelist.  filename can
   23.88 + *  contain the wildcards '*' and '?' in the leaf position, but not in
   23.89 + *  the path. */
   23.90 +void
   23.91 +glob_filename_win32(FileNameList& filelist, const std::string& filename)
   23.92 +{
   23.93 +    // There has got to be an easier way...
   23.94 +    char drive[_MAX_DRIVE];
   23.95 +    char dir[_MAX_DIR];
   23.96 +    char fname[_MAX_FNAME];
   23.97 +    char ext[_MAX_EXT];
   23.98 +    char newFile[_MAX_PATH];
   23.99 +
  23.100 +    _splitpath(filename.c_str(), drive, dir, NULL, NULL);
  23.101 +
  23.102 +    struct _finddata_t finddata;
  23.103 +    intptr_t findhandle = _findfirst(filename.c_str(), &finddata);
  23.104 +    if (findhandle != -1)
  23.105 +    {
  23.106 +        do
  23.107 +        {
  23.108 +            _splitpath(finddata.name, NULL, NULL, fname, ext);
  23.109 +            _makepath(newFile, drive, dir, fname, ext);
  23.110 +            filelist.push_back(std::string(newFile));
  23.111 +        }
  23.112 +        while (_findnext(findhandle, &finddata) == 0);
  23.113 +        _findclose(findhandle);
  23.114 +    }
  23.115 +}
  23.116 +#endif
  23.117 +
  23.118 +
  23.119 +/** Answer line will leading and trailing whitespace removed.
  23.120 + *  Normalize blank lines and lines starting with a comment character
  23.121 + *  to an empty string.  Remove all whitespace between the
  23.122 + *  response-file character and the following filename. */
  23.123 +std::string
  23.124 +normalize_response_file_line(const std::string& line)
  23.125 +{
  23.126 +    std::string result;
  23.127 +    std::string::size_type begin = line.find_first_not_of(WHITESPACE_CHARS);
  23.128 +
  23.129 +    if (begin != std::string::npos && line[begin] != RESPONSE_FILE_COMMENT_CHAR)
  23.130 +    {
  23.131 +        const std::string::size_type end = line.find_last_not_of(WHITESPACE_CHARS);
  23.132 +
  23.133 +        if (line[begin] == RESPONSE_FILE_PREFIX_CHAR)
  23.134 +        {
  23.135 +            begin = line.find_first_not_of(WHITESPACE_CHARS, begin + 1);
  23.136 +            result += RESPONSE_FILE_PREFIX_CHAR;
  23.137 +        }
  23.138 +        if (begin != std::string::npos)
  23.139 +        {
  23.140 +            result += line.substr(begin, end - begin + 1);
  23.141 +        }
  23.142 +    }
  23.143 +
  23.144 +    return result;
  23.145 +}
  23.146 +
  23.147 +
  23.148 +static const key_value_pair empty_pair(std::make_pair(std::string(), std::string()));
  23.149 +
  23.150 +
  23.151 +/** Answer the key-value pair in line or a pair of null strings, if
  23.152 + * line does not define a syntactic comment.
  23.153 + *
  23.154 + * A syntactic comment line matches
  23.155 + *         ^[ \t]* # [ \t]* ([A-Za-z-]*) [ \t]* : [ \t]* ([^ \t]*) [ \t]*$
  23.156 + * where the first captured string is the key and second one is the
  23.157 + * value.
  23.158 + */
  23.159 +key_value_pair
  23.160 +get_syntactic_comment(const std::string& line)
  23.161 +{
  23.162 +    std::string::size_type begin = line.find_first_not_of(WHITESPACE_CHARS);
  23.163 +
  23.164 +    if (begin != std::string::npos && line[begin] == RESPONSE_FILE_COMMENT_CHAR)
  23.165 +    {
  23.166 +        begin = line.find_first_not_of(WHITESPACE_CHARS, begin + 1);
  23.167 +        if (begin != std::string::npos)
  23.168 +        {
  23.169 +            std::string::size_type end = begin + 1;
  23.170 +            while (end < line.size() && (isalpha(line[end]) || line[end] == '-'))
  23.171 +            {
  23.172 +                ++end;
  23.173 +            }
  23.174 +            const std::string key = line.substr(begin, end - begin);
  23.175 +
  23.176 +            begin = line.find_first_not_of(WHITESPACE_CHARS, end);
  23.177 +            if (begin != std::string::npos && line[begin] == KEY_VALUE_SEPARATOR_CHAR)
  23.178 +            {
  23.179 +                begin = line.find_first_not_of(WHITESPACE_CHARS, begin + 1);
  23.180 +                if (begin == std::string::npos)
  23.181 +                {
  23.182 +                    return std::make_pair(key, std::string());
  23.183 +                }
  23.184 +                else
  23.185 +                {
  23.186 +                    end = line.find_last_not_of(WHITESPACE_CHARS);
  23.187 +                    return std::make_pair(key, line.substr(begin, end - begin + 1));
  23.188 +                }
  23.189 +            }
  23.190 +            else
  23.191 +            {
  23.192 +                return empty_pair;
  23.193 +            }
  23.194 +        }
  23.195 +        else
  23.196 +        {
  23.197 +            return empty_pair;
  23.198 +        }
  23.199 +    }
  23.200 +    else
  23.201 +    {
  23.202 +        return empty_pair;
  23.203 +    }
  23.204 +}
  23.205 +
  23.206 +
  23.207 +void
  23.208 +unroll_trace(const FilePositionTrace& trace)
  23.209 +{
  23.210 +    for (FilePositionTrace::const_iterator t = trace.begin(); t != trace.end(); ++t)
  23.211 +    {
  23.212 +        std::cerr << command <<
  23.213 +            ": info:    included from \"" << t->first << "\" line " << t->second << '\n';
  23.214 +    }
  23.215 +}
  23.216 +
  23.217 +
  23.218 +class AbstractGlobbingAlgorithm
  23.219 +{
  23.220 +public:
  23.221 +    virtual FileNameList do_glob(const std::string& a_filename,
  23.222 +                                 const FilePositionTrace& trace) = 0;
  23.223 +    virtual ~AbstractGlobbingAlgorithm() {}
  23.224 +    virtual std::string description() const = 0;
  23.225 +};
  23.226 +
  23.227 +
  23.228 +class LiteralGlobbingAlgorithm: public AbstractGlobbingAlgorithm
  23.229 +{
  23.230 +public:
  23.231 +    FileNameList do_glob(const std::string& a_filename,
  23.232 +                         const FilePositionTrace& trace)
  23.233 +    {
  23.234 +        FileNameList result;
  23.235 +        result.push_back(a_filename);
  23.236 +        return result;
  23.237 +    }
  23.238 +
  23.239 +    std::string description() const
  23.240 +    {
  23.241 +        return "Do not glob.  Treat filenames as literals.";
  23.242 +    }
  23.243 +};
  23.244 +
  23.245 +
  23.246 +#ifdef WANT_WILDCARD_GLOBBING
  23.247 +#ifdef _WIN32
  23.248 +
  23.249 +class ShellGlobbingAlgorithm: public AbstractGlobbingAlgorithm
  23.250 +{
  23.251 +public:
  23.252 +    FileNameList do_glob(const std::string& a_filespec,
  23.253 +                         const FilePositionTrace& trace)
  23.254 +    {
  23.255 +        FileNameList result;
  23.256 +        glob_filename_win32(result, a_filespec);
  23.257 +        return result;
  23.258 +    }
  23.259 +
  23.260 +    std::string description() const
  23.261 +    {
  23.262 +        return "Glob only filenames, but not paths.";
  23.263 +    }
  23.264 +};
  23.265 +
  23.266 +#else
  23.267 +
  23.268 +class WildcardGlobbingAlgorithm: public AbstractGlobbingAlgorithm
  23.269 +{
  23.270 +public:
  23.271 +    WildcardGlobbingAlgorithm() : result_vector_(new glob_t) {}
  23.272 +
  23.273 +    ~WildcardGlobbingAlgorithm() {delete result_vector_;}
  23.274 +
  23.275 +    void run_glob(const std::string& a_filespec,
  23.276 +                  const FilePositionTrace& trace,
  23.277 +                  int flags)
  23.278 +    {
  23.279 +        errno = 0;
  23.280 +        if (glob(a_filespec.c_str(),
  23.281 +                 flags,
  23.282 +                 NULL, // (*errfunc)(const char* filename, int error_code)
  23.283 +                 result_vector_) != 0)
  23.284 +        {
  23.285 +            std::cerr << command <<
  23.286 +                ": warning: globbing \"" << a_filespec << "\" failed: " <<
  23.287 +                errorMessage(errno) << "\n";
  23.288 +            unroll_trace(trace);
  23.289 +        }
  23.290 +    }
  23.291 +
  23.292 +    void convert_to_list()
  23.293 +    {
  23.294 +        result_.clear();
  23.295 +
  23.296 +        for (char** path = result_vector_->gl_pathv; *path != NULL; ++path)
  23.297 +        {
  23.298 +            result_.push_back(*path);
  23.299 +        }
  23.300 +    }
  23.301 +
  23.302 +    FileNameList do_glob(const std::string& a_filespec,
  23.303 +                         const FilePositionTrace& trace)
  23.304 +    {
  23.305 +        run_glob(a_filespec, trace, GLOB_ERR);
  23.306 +        convert_to_list();
  23.307 +        globfree(result_vector_);
  23.308 +
  23.309 +        return result_;
  23.310 +    }
  23.311 +
  23.312 +    std::string description() const
  23.313 +    {
  23.314 +        return "Glob with wildcards '?', '*', '[', and ']'.  See glob(7).";
  23.315 +    }
  23.316 +
  23.317 +protected:
  23.318 +    glob_t* result_vector_;
  23.319 +    FileNameList result_;
  23.320 +};
  23.321 +
  23.322 +
  23.323 +class ShellGlobbingAlgorithm : public WildcardGlobbingAlgorithm
  23.324 +{
  23.325 +public:
  23.326 +    FileNameList do_glob(const std::string& a_filespec,
  23.327 +                         const FilePositionTrace& trace)
  23.328 +    {
  23.329 +        run_glob(a_filespec, trace, GLOB_ERR | GLOB_BRACE | GLOB_TILDE_CHECK);
  23.330 +        convert_to_list();
  23.331 +        globfree(result_vector_);
  23.332 +
  23.333 +        return result_;
  23.334 +    }
  23.335 +
  23.336 +    std::string description() const
  23.337 +    {
  23.338 +        return "Glob like UN*X shells do.  Like \"wildcard\" plus '{', '}', and '~'.  See glob(7).";
  23.339 +    }
  23.340 +};
  23.341 +
  23.342 +#endif // _WIN32
  23.343 +#endif // WANT_WILDCARD_GLOBBING
  23.344 +
  23.345 +
  23.346 +#define MAKE_ALGORITHM(m_algorithm_pointer) \
  23.347 +    std::make_pair(false, static_cast<AbstractGlobbingAlgorithm*>(m_algorithm_pointer))
  23.348 +
  23.349 +#define MAKE_ALIAS(m_algorithm_pointer) \
  23.350 +    std::make_pair(true, m_algorithm_pointer)
  23.351 +
  23.352 +
  23.353 +// List of algorithm name / algorithm description pairs
  23.354 +typedef std::list<std::pair<std::string, std::string> > algorithm_list;
  23.355 +
  23.356 +
  23.357 +class Globbing
  23.358 +{
  23.359 +    // Map from the names of the algorithms or aliases to the
  23.360 +    // algorithm itself.  The boolean flag indicates whether we point
  23.361 +    // to the algorithm proper or the name is just an alias to an
  23.362 +    // existing algorithm.
  23.363 +    typedef std::map<std::string, std::pair<bool, AbstractGlobbingAlgorithm*> > algorithm_map;
  23.364 +
  23.365 +public:
  23.366 +    Globbing() : algorithm_name_("literal"), algorithm_(NULL)
  23.367 +    {
  23.368 +        installed_algorithms_ =
  23.369 +            boost::assign::map_list_of
  23.370 +            ("literal", MAKE_ALGORITHM(new LiteralGlobbingAlgorithm))
  23.371 +#ifdef WANT_WILDCARD_GLOBBING
  23.372 +            ("wildcard", MAKE_ALGORITHM(new WildcardGlobbingAlgorithm))
  23.373 +            ("shell", MAKE_ALGORITHM(new ShellGlobbingAlgorithm))
  23.374 +#endif
  23.375 +            ;
  23.376 +
  23.377 +        setup_alias("literal", "none");
  23.378 +        setup_alias("shell", "sh");
  23.379 +    }
  23.380 +
  23.381 +    ~Globbing()
  23.382 +    {
  23.383 +        for (algorithm_map::const_iterator i = installed_algorithms_.begin();
  23.384 +             i != installed_algorithms_.end();
  23.385 +             ++i)
  23.386 +        {
  23.387 +            if (!i->second.first) // not an alias
  23.388 +            {
  23.389 +                delete i->second.second;
  23.390 +            }
  23.391 +        }
  23.392 +
  23.393 +        algorithm_ = NULL;
  23.394 +    }
  23.395 +
  23.396 +    const std::string& get_algorithm() const
  23.397 +    {
  23.398 +        return algorithm_name_;
  23.399 +    }
  23.400 +
  23.401 +    bool set_algorithm(const std::string& an_algorithm_name)
  23.402 +    {
  23.403 +        algorithm_map::const_iterator a = installed_algorithms_.find(an_algorithm_name);
  23.404 +        if (a != installed_algorithms_.end())
  23.405 +        {
  23.406 +            algorithm_name_ = a->first;
  23.407 +            algorithm_ = a->second.second;
  23.408 +            return true;
  23.409 +        }
  23.410 +        else
  23.411 +        {
  23.412 +            return false;
  23.413 +        }
  23.414 +    }
  23.415 +
  23.416 +    FileNameList expand(const std::string& a_filename, const FilePositionTrace& trace)
  23.417 +    {
  23.418 +        if (algorithm_ == NULL)
  23.419 +        {
  23.420 +            set_algorithm(algorithm_name_);
  23.421 +        }
  23.422 +        return algorithm_->do_glob(a_filename, trace);
  23.423 +    }
  23.424 +
  23.425 +    algorithm_list get_known_algorithms() const
  23.426 +    {
  23.427 +        algorithm_list result;
  23.428 +        for (algorithm_map::const_iterator i = installed_algorithms_.begin();
  23.429 +             i != installed_algorithms_.end();
  23.430 +             ++i)
  23.431 +        {
  23.432 +            std::string description = i->second.second->description();
  23.433 +            if (i->second.first)
  23.434 +            {
  23.435 +                description += " (alias)";
  23.436 +            }
  23.437 +            result.push_back(make_pair(i->first, description));
  23.438 +        }
  23.439 +        return result;
  23.440 +    }
  23.441 +
  23.442 +    void setup_alias(const std::string& an_algorithm_name, const std::string& an_alias)
  23.443 +    {
  23.444 +        algorithm_map::const_iterator a = installed_algorithms_.find(an_algorithm_name);
  23.445 +        installed_algorithms_[an_alias] = MAKE_ALIAS(a->second.second);
  23.446 +    }
  23.447 +
  23.448 +private:
  23.449 +    std::string algorithm_name_;
  23.450 +    AbstractGlobbingAlgorithm* algorithm_;
  23.451 +
  23.452 +    algorithm_map installed_algorithms_;
  23.453 +};
  23.454 +
  23.455 +
  23.456 +algorithm_list
  23.457 +known_algorithms()
  23.458 +{
  23.459 +    Globbing glob;
  23.460 +    return glob.get_known_algorithms();
  23.461 +}
  23.462 +
  23.463 +
  23.464 +//< src::RESPONSE_FILE_MAX_NESTING_LEVEL 63
  23.465 +#define RESPONSE_FILE_MAX_NESTING_LEVEL 63U
  23.466 +
  23.467 +
  23.468 +void
  23.469 +unfold_filename_iter(TraceableFileNameList& result,
  23.470 +                     unsigned nesting_level, const std::string& current_directory, FilePositionTrace& trace,
  23.471 +                     const std::string& filename)
  23.472 +{
  23.473 +    // Checking the nesting_lavel acts as an emergency break in the
  23.474 +    // case our usual recusion detection fails.
  23.475 +    if (nesting_level > RESPONSE_FILE_MAX_NESTING_LEVEL)
  23.476 +    {
  23.477 +        std::cerr <<
  23.478 +            command << ": warning: excessive nesting of " << nesting_level << " levels of response files;\n" <<
  23.479 +            command << ": warning:     possible infinite recursion in \"" << filename << "\"\n";
  23.480 +        unroll_trace(trace);
  23.481 +        return;
  23.482 +    }
  23.483 +
  23.484 +    if (filename.empty())
  23.485 +    {
  23.486 +        std::cerr << command << ": info: empty filename\n";
  23.487 +        unroll_trace(trace);
  23.488 +        return;
  23.489 +    }
  23.490 +    else if (filename[0] == RESPONSE_FILE_PREFIX_CHAR)
  23.491 +    {
  23.492 +        const std::string response_filename(filename, 1); // filename alone
  23.493 +#ifdef DEBUG_FILESPEC
  23.494 +        std::cout <<
  23.495 +            "+ unfold_filename_iter: concatPath(current_directory, response_filename) = <" <<
  23.496 +            concatPath(current_directory, response_filename) << ">\n";
  23.497 +#endif
  23.498 +        const std::string response_filepath = // filename in the right path
  23.499 +            enblend::canonicalizePath(enblend::isRelativePath(response_filename) ?
  23.500 +                                      concatPath(current_directory, response_filename) :
  23.501 +                                      response_filename,
  23.502 +                                      false);
  23.503 +
  23.504 +        for (FilePositionTrace::const_iterator t = trace.begin(); t != trace.end(); ++t)
  23.505 +        {
  23.506 +            if (t->first == response_filepath)
  23.507 +            {
  23.508 +                std::cerr << command <<
  23.509 +                    ": warning: response file \"" << response_filepath << "\" recursively\n";
  23.510 +                unroll_trace(trace);
  23.511 +                return;
  23.512 +            }
  23.513 +        }
  23.514 +
  23.515 +#ifdef DEBUG_FILESPEC
  23.516 +        std::cout <<
  23.517 +            "+ unfold_filename_iter: current_directory = " << current_directory << "\n" <<
  23.518 +            "+ unfold_filename_iter: response_filename = " << response_filename << "\n" <<
  23.519 +            "+ unfold_filename_iter: response_filepath = " << response_filepath << "\n";
  23.520 +#endif
  23.521 +
  23.522 +        if (Verbose >= VERBOSE_RESPONSE_FILES)
  23.523 +        {
  23.524 +            std::cerr << command <<
  23.525 +                ": info: consulting response file \"" << response_filepath << "\"\n";
  23.526 +        }
  23.527 +
  23.528 +        errno = 0;
  23.529 +        std::ifstream response_file(response_filepath.c_str());
  23.530 +        if (response_file)
  23.531 +        {
  23.532 +            Globbing glob;
  23.533 +            unsigned line_number = 0U;
  23.534 +
  23.535 +            while (true)
  23.536 +            {
  23.537 +                std::string buffer;
  23.538 +
  23.539 +                errno = 0;
  23.540 +                getline(response_file, buffer);
  23.541 +                if (!response_file.good())
  23.542 +                {
  23.543 +                    if (!buffer.empty())
  23.544 +                    {
  23.545 +                        std::cerr <<
  23.546 +                            command << ": warning: ignoring last line of response file \"" <<
  23.547 +                            response_filepath << "\" line " << line_number + 1U << ",\n" <<
  23.548 +                            command << ": warning:     because it does not end with a newline\n";
  23.549 +                        unroll_trace(trace);
  23.550 +                    }
  23.551 +                    break;
  23.552 +                }
  23.553 +                ++line_number;
  23.554 +
  23.555 +                if (line_number == 1U)
  23.556 +                {
  23.557 +                    const key_value_pair comment = get_syntactic_comment(buffer);
  23.558 +                    if ((comment.first == "glob" || comment.first == "globbing") &&
  23.559 +                        !comment.second.empty())
  23.560 +                    {
  23.561 +                        if (!glob.set_algorithm(comment.second))
  23.562 +                        {
  23.563 +                            std::cerr <<
  23.564 +                                command <<
  23.565 +                                ": warning: requested unknown globbing algorithm \"" <<
  23.566 +                                comment.second <<
  23.567 +                                "\" in response file \"" << response_filepath << "\" line " <<
  23.568 +                                line_number << "\n" <<
  23.569 +                                command <<
  23.570 +                                ": warning:     will stick with algorithm \"" <<
  23.571 +                                glob.get_algorithm() << "\"\n";
  23.572 +                            unroll_trace(trace);
  23.573 +                        }
  23.574 +                    }
  23.575 +                    // We silently ignore all other keys or empty
  23.576 +                    // values with the right key.
  23.577 +                }
  23.578 +
  23.579 +                const std::string line(normalize_response_file_line(buffer));
  23.580 +                if (line.empty())
  23.581 +                {
  23.582 +                    continue;
  23.583 +                }
  23.584 +
  23.585 +                const std::string response_directory = extractDirname(response_filepath);
  23.586 +#ifdef DEBUG_FILESPEC
  23.587 +                std::cout << "+ unfold_filename_iter: response_directory = " << response_directory << "\n";
  23.588 +#endif
  23.589 +                TraceableFileNameList partial_result;
  23.590 +                trace.push_front(std::make_pair(response_filepath, line_number));
  23.591 +                unfold_filename_iter(partial_result,
  23.592 +                                     nesting_level + 1U, response_directory, trace,
  23.593 +                                     line);
  23.594 +
  23.595 +                for (TraceableFileNameList::const_iterator p = partial_result.begin();
  23.596 +                     p != partial_result.end();
  23.597 +                     ++p)
  23.598 +                {
  23.599 +                    const FileNameList expanded_partial_result = glob.expand(p->first, trace);
  23.600 +                    for (FileNameList::const_iterator q = expanded_partial_result.begin();
  23.601 +                         q != expanded_partial_result.end();
  23.602 +                         ++q)
  23.603 +                    {
  23.604 +                        if (enblend::isRelativePath(*q))
  23.605 +                        {
  23.606 +                            const std::string path =
  23.607 +                                enblend::canonicalizePath(concatPath(response_directory, *q), false);
  23.608 +#ifdef DEBUG_FILESPEC
  23.609 +                            std::cout <<
  23.610 +                                "+ unfold_filename_iter: relative path\n" <<
  23.611 +                                "+ unfold_filename_iter:     q = " << *q << "\n" <<
  23.612 +                                "+ unfold_filename_iter:     path = <" << path << ">\n";
  23.613 +#endif
  23.614 +                            result.insert(result.end(), std::make_pair(path, trace));
  23.615 +                        }
  23.616 +                        else
  23.617 +                        {
  23.618 +#ifdef DEBUG_FILESPEC
  23.619 +                            std::cout << "+ unfold_filename_iter: absolute path\n";
  23.620 +#endif
  23.621 +                            result.insert(result.end(), std::make_pair(*q, trace));
  23.622 +                        }
  23.623 +                    }
  23.624 +                }
  23.625 +
  23.626 +                trace.pop_front();
  23.627 +            }
  23.628 +            if (!response_file.eof())
  23.629 +            {
  23.630 +                std::cerr << command <<
  23.631 +                    ": warning: filesystem signals problems in response file \"" <<
  23.632 +                    response_filepath << "\" line " << line_number << ": " <<
  23.633 +                    errorMessage(errno) << "\n";
  23.634 +                unroll_trace(trace);
  23.635 +            }
  23.636 +        }
  23.637 +        else
  23.638 +        {
  23.639 +            std::cerr << command <<
  23.640 +                ": failed to open response file \"" << response_filepath << "\": " <<
  23.641 +                errorMessage(errno) << "\n";
  23.642 +            unroll_trace(trace);
  23.643 +            exit(1);
  23.644 +        }
  23.645 +    }
  23.646 +    else
  23.647 +    {
  23.648 +        result.push_back(std::make_pair(filename, trace));
  23.649 +    }
  23.650 +}
  23.651 +
  23.652 +
  23.653 +void
  23.654 +unfold_filename(TraceableFileNameList& result, const std::string& filename)
  23.655 +{
  23.656 +#ifdef _WIN32
  23.657 +    // This stupid wannbe OS, lacking a shell that deserves the name,
  23.658 +    // passes unexpanded wildcards in filename.  We ameliorate the
  23.659 +    // situation by doing some of the globbing ourselves; see
  23.660 +    // glob_filename_win32().
  23.661 +    FileNameList initial_files;
  23.662 +
  23.663 +    if (!filename.empty() && filename[0] == RESPONSE_FILE_PREFIX_CHAR)
  23.664 +    {
  23.665 +        initial_files.push_back(filename);
  23.666 +    }
  23.667 +    else
  23.668 +    {
  23.669 +        // Not a response file, so we expand wildcards.
  23.670 +        glob_filename_win32(initial_files, filename);
  23.671 +    }
  23.672 +
  23.673 +    for (FileNameList::const_iterator i = initial_files.begin();
  23.674 +         i != initial_files.end();
  23.675 +         ++i)
  23.676 +    {
  23.677 +        FilePositionTrace trace;
  23.678 +        unfold_filename_iter(result, 0U, "", trace, *i);
  23.679 +    }
  23.680 +#else
  23.681 +    FilePositionTrace trace;
  23.682 +    unfold_filename_iter(result, 0U, "", trace, filename);
  23.683 +#endif
  23.684 +}
  23.685 +
  23.686 +
  23.687 +// ANTICIPATED CHANGE: We already have the same function in
  23.688 +// "common.h".  There it is called toLower().  However, we cannot
  23.689 +// include this file here.  The solution is to factor out string
  23.690 +// functions into their own module.
  23.691 +std::string
  23.692 +lower_case(const std::string& aString)
  23.693 +{
  23.694 +    std::string result(aString);
  23.695 +    std::transform(aString.begin(), aString.end(), result.begin(), tolower);
  23.696 +    return result;
  23.697 +}
  23.698 +
  23.699 +
  23.700 +bool
  23.701 +is_known_extension_to_vigra(const std::string& filename)
  23.702 +{
  23.703 +    const std::string known_extensions = vigra::impexListExtensions();
  23.704 +    const std::string extension =
  23.705 +        lower_case(filename.substr(filename.rfind(".") + 1));
  23.706 +
  23.707 +    return known_extensions.find(extension) != std::string::npos;
  23.708 +}
  23.709 +
  23.710 +
  23.711 +bool
  23.712 +maybe_response_file(const std::string& filename)
  23.713 +{
  23.714 +    std::ifstream file(filename.c_str());
  23.715 +    if (file)
  23.716 +    {
  23.717 +        unsigned line_number = 0U;
  23.718 +        unsigned score = 0U;
  23.719 +
  23.720 +        while (line_number < RESPONSE_FILE_LINES_TO_CHECK)
  23.721 +        {
  23.722 +            std::string buffer;
  23.723 +
  23.724 +            getline(file, buffer);
  23.725 +            if (!file.good())
  23.726 +            {
  23.727 +                break;
  23.728 +            }
  23.729 +            ++line_number;
  23.730 +
  23.731 +            const std::string line(normalize_response_file_line(buffer));
  23.732 +            if (line.empty())
  23.733 +            {
  23.734 +                continue;
  23.735 +            }
  23.736 +
  23.737 +            if (line[0] == RESPONSE_FILE_PREFIX_CHAR ||
  23.738 +                is_known_extension_to_vigra(line))
  23.739 +            {
  23.740 +                ++score;
  23.741 +            }
  23.742 +        }
  23.743 +
  23.744 +        return line_number >= 1U && score * 8U >= line_number * 7U;
  23.745 +    }
  23.746 +    else
  23.747 +    {
  23.748 +        return false;
  23.749 +    }
  23.750 +}
  23.751 +
  23.752 +} // namespace enblend
    24.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.2 +++ b/src/filespec.h	Fri Nov 06 09:42:01 2009 +0100
    24.3 @@ -0,0 +1,58 @@
    24.4 +/*
    24.5 + * Copyright (C) 2009 Christoph L. Spiel
    24.6 + *
    24.7 + * This file is part of Enblend.
    24.8 + *
    24.9 + * Enblend is free software; you can redistribute it and/or modify
   24.10 + * it under the terms of the GNU General Public License as published by
   24.11 + * the Free Software Foundation; either version 2 of the License, or
   24.12 + * (at your option) any later version.
   24.13 + *
   24.14 + * Enblend is distributed in the hope that it will be useful,
   24.15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
   24.16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   24.17 + * GNU General Public License for more details.
   24.18 + *
   24.19 + * You should have received a copy of the GNU General Public License
   24.20 + * along with Enblend; if not, write to the Free Software
   24.21 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   24.22 + */
   24.23 +#ifndef __FILESPEC_H__
   24.24 +#define __FILESPEC_H__
   24.25 +
   24.26 +#include <list>
   24.27 +#include <string>
   24.28 +
   24.29 +
   24.30 +#define RESPONSE_FILE_PREFIX_CHAR '@'
   24.31 +#define RESPONSE_FILE_COMMENT_CHAR '#'
   24.32 +#define WHITESPACE_CHARS "\n\r\t "
   24.33 +
   24.34 +
   24.35 +namespace enblend
   24.36 +{
   24.37 +    typedef std::list<std::string> FileNameList;
   24.38 +
   24.39 +    typedef std::pair<std::string, unsigned> FilePosition; /** Filename, line number pairs */
   24.40 +    typedef std::list<FilePosition> FilePositionTrace;     /** Traceback to a file position */
   24.41 +    typedef std::pair<std::string, FilePositionTrace> TraceableFileName; /** Filename, traceback pairs */
   24.42 +    typedef std::list<TraceableFileName> TraceableFileNameList; /** */
   24.43 +
   24.44 +
   24.45 +    /** Print the (back-)trace of all response files opened so far. */
   24.46 +    void unroll_trace(const FilePositionTrace& trace);
   24.47 +
   24.48 +    /** Recursively unfold filename which may be a literal name or a
   24.49 +     *  response file.  The result is a list of only literal
   24.50 +     *  filenames. */
   24.51 +    void unfold_filename(TraceableFileNameList& result, const std::string& filename);
   24.52 +
   24.53 +    /** Answer whether we suspect filename is a response file. */
   24.54 +    bool maybe_response_file(const std::string& filename);
   24.55 +}
   24.56 +
   24.57 +#endif /* __FILESPEC_H__ */
   24.58 +
   24.59 +// Local Variables:
   24.60 +// mode: c++
   24.61 +// End:
    25.1 --- a/src/global.h	Tue Nov 03 13:56:24 2009 +0100
    25.2 +++ b/src/global.h	Fri Nov 06 09:42:01 2009 +0100
    25.3 @@ -40,7 +40,9 @@
    25.4  #define VERBOSE_SIGNATURE_REPORTING         2
    25.5  #define VERBOSE_VERSION_REPORTING           2
    25.6  
    25.7 +
    25.8  #define VERBOSE_COLOR_CONVERSION_MESSAGES   3
    25.9 +#define VERBOSE_RESPONSE_FILES              3
   25.10  
   25.11  #define VERBOSE_ABB_MESSAGES                4
   25.12  #define VERBOSE_IBB_MESSAGES                4
    26.1 --- a/src/mask.h	Tue Nov 03 13:56:24 2009 +0100
    26.2 +++ b/src/mask.h	Fri Nov 06 09:42:01 2009 +0100
    26.3 @@ -750,7 +750,7 @@
    26.4                       const Rect2D& iBB,
    26.5                       bool wraparound,
    26.6                       unsigned numberOfImages,
    26.7 -                     list<char*>::const_iterator inputFileNameIterator,
    26.8 +                     FileNameList::const_iterator inputFileNameIterator,
    26.9                       unsigned m)
   26.10  {
   26.11      typedef typename ImageType::PixelType ImagePixelType;