logo separator

[mkgmap-dev] new feature request, New style command 'goto'

From Joris Bo jorisbo at hotmail.com on Sat May 16 08:19:56 BST 2020

Hello,

I finished a fancy but complex 'access evaluator' together with unittests prior to set the { mkgmap:car/truck/bicycle=yes/no/toll }
It was not easy to keep it maintainable. The complexity makes it more difficult to keep in mind the impact of existing sections.

The current mkgmap technique is processing line by line and first stops after a match is found resulting in an object to be visible in the map.
Even if the match is a 1000 lines down the road (and even when I know its useless to try 999 of them) it will process them all, enabling the chance of a false positive (in between).

I was wondering if it would be difficult to implement a new feature called : "goto' which immediately jumps to a certain section and continues from there.
It is like the batch command 'goto, gosub'. Today for example I need to exclude rule after rule the possible existence of certain tags which are tested later on, to avoid an unexpected early match. It would be easier to just skip these parts and jump to the 'right section'.

Because the software today also includes rules on the fly, and also uses 'if () then ... end' exclusions and also jumps to the finalizer if a match is found,  it maybe just as simple as jump to another section? This will help a lot. It even implements the possibility of subroutines which I now do sequential bij calling  the "include file" mechanism 9 times in a row for every transport type.

Just a thought, it also works without this, but it would help a lot spending less debugging time. Especially after re-arranging sections which today for sure will end up with unexpected results.

For example:
include 'inc/myaccessrules';
myvariable:notransporttypeallowedatall = true {goto mynonroutablehighwaysection}

<myhighwaysection>
#don't bother the private and non-routable, it is already managed elsewhere


building = * {goto mybuildingsection}
natural = * {goto mynaturalsection}

<myshopsection>
shop = *  & building !=* & natural !=* & amenity!=restaurant {name '${name}' | '${ housename}'} [0x0400 resolution 12-22 continue]

<mybuildingsection>
building = * {name '${name}' | '${addr:housename}'} [0x05 resolution 12-22 continue]

<finalize>  #reserved section name


Kind reagards
Jorisbo at hotmail.com<mailto:Jorisbo at hotmail.com>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mkgmap.org.uk/pipermail/mkgmap-dev/attachments/20200516/70670086/attachment.html>


More information about the mkgmap-dev mailing list