Re: [exim] fun with ACLs

Top Page
Delete this message
Reply to this message
Author: Tony Finch
Date:  
To: Chris Lear
CC: exim-users
Subject: Re: [exim] fun with ACLs
On Thu, 31 Mar 2005, Chris Lear wrote:
>
> An exim acl mandelbrot set, anyone?


The problem with attempting to write programs in exim.conf is Exim's
restrictions on the amount of work it is willing to do, e.g. the number of
child addresses before it gives up routeing or the depth of recursion in
ACLs. This makes long loops (such as scanning the complex plane for a
Mandelbrot set) rather awkward. However you can avoid this problem by
doing a recursive quadratic subdivision of the plane, which changes tail
recursion 2^N deep into multiple recursion N deep; however this introduces
the problem of managing recursion which can be rather fiddly - see the
hanoi ACL for an example. One thing I didn't develop yesterday evening was
a way of treating an acl variable as a stack, e.g.
    # push
    set acl_c0 = newval $acl_c0
    # pop
    set acl_c0 =    ${sg {$acl_c0} {\S+(.*)} {\$1} }
    # get top of stack
            ${extract {1}{ } {$acl_c0} }
But you rapidly find that string expansions are not the most convenient
syntax for this kind of thing. (Some might think that sentence is true in
general!)


The other looping problem with computing Mandelbrot sets is the iteration
for each point, which also stretches the limits of what Exim allows.
Tricks with ACL recursion are probably too painful; so it's probably
easier to use address routeing instead, since you can invoke that from an
ACL with verify = sender=${ address containing the point's co-ordinates }
and that gives you 50 iterations which is enough for a low-res image.

What's really difficult is getting the output in a useful form. Recursive
quadtratic subdivision makes this extra painful because the points aren't
computed a line at a time. So you'd have to build up a string in an acl
variable to represent the plane, and use a fantastically complicated
expansion expression to modify a character in it for each point, then
print the whole thing (e.g. using a message modifier) at the end.

Tony.
--
<fanf@???> <dot@???> http://dotat.at/ ${sg{\N${sg{\
N\}{([^N]*)(.)(.)(.*)}{\$1\$3\$2\$1\$3\n\$2\$3\$4\$3\n\$3\$2\$4}}\
\N}{([^N]*)(.)(.)(.*)}{\$1\$3\$2\$1\$3\n\$2\$3\$4\$3\n\$3\$2\$4}}