logo separator

[mkgmap-dev] natural=wetland; why is ~ disallowed at top level?

From Steve Ratcliffe steve at parabola.me.uk on Mon Jan 18 00:12:24 GMT 2010

On 17/01/10 20:06, Marko Mäkelä wrote:

Hi Marko

> 1. What if there are multiple actions for natural=mud?
> Which one(s) will be processed and in which order?

If there are multiple rules with the first term natural=mud then they
are put into a list in the order that they occur in the file. They are
then evaluated in order until one matches.  Only the conditions after
natural=mud are run, eg for the rules:

   natural=mud & colour=brown [0x50 ...]
   natural=mud [0x51 ...]

you create a list of instructions that does the following:
   if colour == brown then return [0x50, ...]
   return [0x51, ...]

> 2. How and when are top-level AND expressions evaluated?

I think the above example shows how the first AND is evaluated: first
you look up the program list via natural=mud and then you evaluate
colour=brown.  The second and subsequent ANDs are handled normally by
the AndOp class.

> 3. Why doesn't RuleFileReader.optimiseAndSaveBinaryOp() check for
> second.isType(EXISTS)?  Why doesn't it attempt to swap operands when
> first.isType(NOT_EXISTS)?
No particular reason other than I am never tempted to start a rule
with !=.

So yes you could rewrite (eg):
   a!=b & c=*
as
   c=* & a!=b
that would be valid.

..Steve



More information about the mkgmap-dev mailing list