F/lib template split

This branch introduces a series of patches that splits up the lib/template/templates.{c,h} files to smaller, more independent modules.

A great care was taken in the patches that move files to _not_ change the internal interfaces too much, this is just extracting stuff to separate files and make it compile.

There are numerous rough edges and unpolished interfaces which used to be internal until now, but should be cleaned up to make the code more modular. Also, it'd probably make sense to write unit tests to the individual modules, instead of the integration test we have in test_template.c

Please apply!