Refactored main code section into functions reducing global variables usage greatly

This revision refactors the code present in the main execution path of the module. This reduces the coupling between sections of the code and the constant-implicit use of global variables (options).

This is one more step to make gcovr a better tool and modularize it (more comming soon).